Internal Server error | MySQL server has gone away

NextCloud Version 18.0.10

PHP 7.4.11 (cli) (built: Sep 29 2020 10:17:06) ( NTS )
Copyright © The PHP Group
Zend Engine v3.4.0, Copyright © Zend Technologies
with Zend OPcache v7.4.11, Copyright ©, by Zend Technologies
Memory Limit: 1GB
Max Execution time: 3600
Upload max: 500MB

Server version: 10.4.15-MariaDB-log MariaDB Server
Size: 5.4GB

Server version: Apache/2.4.6 (CentOS)
Server built: Apr 2 2020 13:13:23

the problem that i encountered was about MySQL server has gone away that is why the message appeared in the browser Internal Server error.

My Config.php

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'xxxxxxxxxxxxxxx',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.10.2',
  'overwrite.cli.url' => 'xxxxxxxxxxxxxxx',
  'dbname' => 'xxxxxxxxxxxxxxx',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_adminroot',
  'dbpassword' => 'xxxxxxxxxxxxxxx',
  'installed' => true,
  'mail_from_address' => 'xxxxxxxxxxxxxxx',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'xxxxxxxxxxxxxxx',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtphost' => 'xxxxxxxxxxxxxxx',
  'mail_smtpport' => '587',
  'app.mail.verify-tls-peer' => 'false',
  'maintenance' => false,
  '‘integritycheckdisabled’' => true,
  'logtimezone' => 'Asia/Manila',
  'theme' => '',
  'loglevel' => 0,
  'enable_previews' => true,
  'preview_max_filesize_image' => 100,
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'updater.release.channel' => 'stable',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxxxxxxxxxxxxx',
  'mail_smtppassword' => 'xxxxxxxxxxxxxxx',
  'app_install_overwrite' =>
  array (
    0 => 'xmas',
  ),
);

and i also i run this command mysqlcheck then the result was lost connection

[root@ncserver4 log]# mysqlcheck -c db_nc4 -u root -p
Enter password:
db_ncserver4.oc_accounts OK
db_ncserver4.oc_activity OK
db_ncserver4.oc_activity_mq OK
db_ncserver4.oc_addressbookchanges OK
db_ncserver4.oc_addressbooks OK
db_ncserver4.oc_announcements OK
db_ncserver4.oc_announcements_groups OK
db_ncserver4.oc_appconfig OK
db_ncserver4.oc_authtoken OK
db_ncserver4.oc_bbb_restrictions OK
db_ncserver4.oc_bbb_room_shares OK
db_ncserver4.oc_bbb_rooms OK
db_ncserver4.oc_bruteforce_attempts OK
db_ncserver4.oc_calendar_invitations OK
db_ncserver4.oc_calendar_reminders OK
db_ncserver4.oc_calendar_resources OK
db_ncserver4.oc_calendar_resources_md OK
db_ncserver4.oc_calendar_rooms OK
db_ncserver4.oc_calendar_rooms_md OK
db_ncserver4.oc_calendarchanges OK
db_ncserver4.oc_calendarobjects OK
db_ncserver4.oc_calendarobjects_props OK
db_ncserver4.oc_calendars OK
db_ncserver4.oc_calendarsubscriptions OK
db_ncserver4.oc_cards OK
db_ncserver4.oc_cards_properties OK
db_ncserver4.oc_collres_accesscache OK
db_ncserver4.oc_collres_collections OK
db_ncserver4.oc_collres_resources OK
db_ncserver4.oc_comments OK
db_ncserver4.oc_comments_read_markers OK
db_ncserver4.oc_credentials OK
db_ncserver4.oc_dashboard_data OK
db_ncserver4.oc_dav_cal_proxy OK
db_ncserver4.oc_dav_shares OK
db_ncserver4.oc_direct_edit OK
db_ncserver4.oc_directlink OK
db_ncserver4.oc_external_applicable OK
db_ncserver4.oc_external_config OK
db_ncserver4.oc_external_mounts OK
db_ncserver4.oc_external_options OK
db_ncserver4.oc_federated_reshares OK
db_ncserver4.oc_file_locks OK
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing 'CHECK TABLE … ’
[root@ncserver4 log]#

Thanks

Can you restart the MariaDB server? Perhaps
service mariadb start
or reboot your server.
Any database logs in /var/log ?

Good Morning

yes its more than 5 times that i restarted the service of MySQL and and i checked the exact location of my Mysql Log but it seems no data

[root@nc4server mariadb]# ll -ltr
total 0
-rw-r–r-- 1 root root 0 Oct 30 08:30 slow.log
-rw-r–r-- 1 root root 0 Oct 30 08:37 mariadb.log
[root@nc4server mariadb]#

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 491
Server version: 10.4.15-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> SHOW VARIABLES LIKE ‘log_error’;
±--------------±---------------------------+
| Variable_name | Value |
±--------------±---------------------------+
| log_error | /var/log/mariadb/mariadb.log |
±--------------±---------------------------+
1 row in set (0.002 sec)

MariaDB [(none)]>

but still i got lost connection when run mysqlcheck and internal server

Thanks

Ok i fixed the my mariadb log file and i set to level 4 hoping can find issues. thanks

  2020-10-30 13:00:18 0 [ERROR] InnoDB: Operating system error number 5 in a file operation.
2020-10-30 13:00:18 0 [ERROR] InnoDB: Error number 5 means 'Input/output error'
2020-10-30 13:00:18 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2020-10-30 13:00:18 0 [ERROR] InnoDB: File ./db_ncserver4/oc_filecache.ibd: 'Linux aio' returned OS error 205. Cannot continue operation
201030 13:00:18 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.4.15-MariaDB-log
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=5
max_threads=153
thread_count=11
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467753 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x49000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x56260ace844e]
/usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x56260a77dc6f]
sigaction.c:0(__restore_rt)[0x7f2b93899630]
:0(__GI_raise)[0x7f2b91b6a387]
:0(__GI_abort)[0x7f2b91b6ba78]
/usr/sbin/mysqld(+0xadf695)[0x56260a996695]
/usr/sbin/mysqld(+0xae1289)[0x56260a998289]
/usr/sbin/mysqld(+0xae8c39)[0x56260a99fc39]
/usr/sbin/mysqld(+0xc633c1)[0x56260ab1a3c1]
/usr/sbin/mysqld(+0xb74c48)[0x56260aa2bc48]
pthread_create.c:0(start_thread)[0x7f2b93891ea5]
/lib64/libc.so.6(clone+0x6d)[0x7f2b91c328dd]
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Fatal signal 11 while backtracing
2020-10-30 13:00:37 0 [Note] InnoDB: Using Linux native AIO
2020-10-30 13:00:37 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-10-30 13:00:37 0 [Note] InnoDB: Uses event mutexes
2020-10-30 13:00:37 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
2020-10-30 13:00:37 0 [Note] InnoDB: Number of pools: 1
2020-10-30 13:00:37 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-10-30 13:00:37 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 1, chunk size = 128M
2020-10-30 13:00:38 0 [Note] InnoDB: Completed initialization of buffer pool
2020-10-30 13:00:38 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-10-30 13:00:38 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=252349072538
2020-10-30 13:00:38 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-10-30 13:00:38 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-10-30 13:00:38 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-10-30 13:00:38 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-10-30 13:00:38 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-10-30 13:00:38 0 [Note] InnoDB: Waiting for purge to start
2020-10-30 13:00:38 0 [Note] InnoDB: 10.4.15 started; log sequence number 252349072547; transaction id 102796191
2020-10-30 13:00:38 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-10-30 13:00:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-10-30 13:00:38 0 [Note] Server socket created on IP: '::'.
2020-10-30 13:00:38 0 [Warning] 'proxies_priv' entry '@% root@centos7newnc18' ignored in --skip-name-resolve mode.
2020-10-30 13:00:38 0 [Note] Reading of all Master_info entries succeeded
2020-10-30 13:00:38 0 [Note] Added new Master_info '' to hash table
2020-10-30 13:00:38 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.4.15-MariaDB-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
2020-10-30 13:00:38 0 [Note] InnoDB: Buffer pool(s) load completed at 201030 13:00:38
2020-10-30 13:00:40 8 [Warning] Aborted connection 8 to db: 'db_ncserver4' user: 'oc_adminroot' host: 'localhost' (This connection closed normally)
2020-10-30 13:00:40 9 [Warning] Aborted connection 9 to db: 'db_ncserver4' user: 'oc_adminroot' host: 'localhost' (This connection closed normally)
2020-10-30 13:00:44 10 [Warning] Aborted connection 10 to db: 'db_ncserver4' user: 'oc_adminroot' host: 'localhost' (This connection closed normally)
2020-10-30 13:00:45 11 [Warning] Aborted connection 11 to db: 'db_ncserver4' user: 'oc_adminroot' host: 'localhost' (This connection closed normally)
^C
[root@ncserver4 mariadb]#