"MySQL server has gone away" only on messages, when unread messages are there

"MySQL server has gone away" only on messages, when unread messages are there

by Kristoffer Schill -
Number of replies: 1

Hello,

I have a strange issue with moodle 3.6.6 connecting to the  Mariadb database on our test enviroment, that I can't seem to make sense of...

I get a dmlreadexception - only when I try to open the messages. The strange thing is that can't seem to locate any other place where this occurs.

php errorlog gives me:

[21-Oct-2019 12:33:59 Europe/Stockholm] PHP Warning:  mysqli::query(): MySQL server has gone away in /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php on line 1246
[21-Oct-2019 12:33:59 Europe/Stockholm] PHP Warning:  mysqli::query(): Error reading result set's header in /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php on line 1246

(I have set my config to mariadb and library native, and that file exists but it has not been updated since 2018 so I guess mysqli_native_moodle_database.php uses the right file?)

All tables are utf8mb4_unicode_ci

any tips on where I should look?

diff CURRENT3.6.6 OLD3.6.5+
678,679c678
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "SHOW INDEXES FROM $fixedtable";
---
>         $sql = "SHOW INDEXES FROM {$this->prefix}$table";
750,751c749
<             $fixedtable = $this->fix_table_name($table);
<             $sql = "SHOW COLUMNS FROM $fixedtable";
---
>             $sql = "SHOW COLUMNS FROM {$this->prefix}$table";
1322,1323c1320,1321
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "INSERT INTO $fixedtable ($fields) VALUES($qms)";
---
>
>         $sql = "INSERT INTO {$this->prefix}$table ($fields) VALUES($qms)";
1488,1489c1486
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "INSERT INTO $fixedtable $fieldssql VALUES $valuessql";
---
>         $sql = "INSERT INTO {$this->prefix}$table $fieldssql VALUES $valuessql";
1553,1554c1550
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "UPDATE $fixedtable SET $sets WHERE id=?";
---
>         $sql = "UPDATE {$this->prefix}$table SET $sets WHERE id=?";
1628,1629c1624
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "UPDATE $fixedtable SET $newfield $select";
---
>         $sql = "UPDATE {$this->prefix}$table SET $newfield $select";
1652,1653c1647
<         $fixedtable = $this->fix_table_name($table);
<         $sql = "DELETE FROM $fixedtable $select";
---
>         $sql = "DELETE FROM {$this->prefix}$table $select";
2026,2052d2019
<     }
<
<     /**
<      * Does this mysql instance support fulltext indexes?
<      *
<      * @return bool
<      */
<     public function is_fulltext_search_supported() {
<         $info = $this->get_server_info();
<
<         if (version_compare($info['version'], '5.6.4', '>=')) {
<             return true;
<         }
<         return false;
<     }
<
<     /**
<      * Fixes any table names that clash with reserved words.
<      *
<      * @param string $tablename The table name
<      * @return string The fixed table name
<      */
<     protected function fix_table_name($tablename) {
<         $prefixedtablename = parent::fix_table_name($tablename);
<         // This function quotes the table name if it matches one of the MySQL reserved
<         // words, e.g. groups.
<         return $this->get_manager()->generator->getEncQuoted($prefixedtablename);

As it is mariadb 10.1.41 it should have fulltext_search(?)

MariaDB [<our QA Schema>]> select table_name, column_name from information_schema.STATISTICS  where table_schema = '<our QA schema>'  and index_type = 'FULLTEXT';
+---------------------------+--------------+
| table_name                | column_name  |
+---------------------------+--------------+
| mdl_search_simpledb_index | title        |
| mdl_search_simpledb_index | content      |
| mdl_search_simpledb_index | description1 |
| mdl_search_simpledb_index | description2 |
+---------------------------+--------------+
4 rows in set (0.02 sec)

Any tips or hints would be greatly appreciated.
Average of ratings: -
In reply to Kristoffer Schill

Re: "MySQL server has gone away" only on messages, when unread messages are there

by William Lu -
Picture of Particularly helpful Moodlers
Moving to the Installing forum...