Help, I can't read messages dmlreadexception

Help, I can't read messages dmlreadexception

by carlos sandoval -
Number of replies: 6

Please some idea about could be the problem?. When i try to read some messages i get a "dmlreadexception"




debugging info for this message is:


File: /lib/dml/moodle_database.php

Line: 486


SQL server has gone away

SELECT mdl_context.id AS ctxid, mdl_context.path AS ctxpath, mdl_context.depth AS ctxdepth, mdl_context.contextlevel AS ctxlevel, mdl_context.instanceid AS ctxinstance, mdl_context.locked AS ctxlocked FROM mdl_context WHERE id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) 

-- line 1500 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()

-- line 663 of /message/classes/api.php: call to context_helper::preload_contexts_by_id()

-- line 1348 of /message/externallib.php: call to core_message\api::get_conversations()

-- line 261 of /lib/externallib.php: call to core_message_external::get_conversations()

-- line 81 of /lib/ajax/service.php: call to external_api::call_external_function()

[array (

  0 => NULL,

  1 => NULL,

  2 => NULL,

  3 => NULL,

  4 => NULL,

  5 => NULL,

  6 => NULL,

  7 => NULL,

  8 => NULL,

  9 => NULL,

  10 => NULL,

  11 => NULL,

  12 => NULL,

  13 => NULL,

  14 => NULL,

  15 => NULL,

  16 => NULL,

  17 => NULL,

  18 => NULL,

  19 => NULL,

  20 => NULL,

  21 => NULL,

  22 => NULL,

)]

Error code: dmlreadexception


* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown

* line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

* line 1500 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()

* line 6123 of /lib/accesslib.php: call to moodle_database->get_records_select()

* line 663 of /message/classes/api.php: call to context_helper::preload_contexts_by_id()

* line 1348 of /message/externallib.php: call to core_message\api::get_conversations()

* line 261 of /lib/externallib.php: call to core_message_external::get_conversations()

* line 81 of /lib/ajax/service.php: call to external_api::call_external_function()


Variables in the database are:

+--------------------+---------+

| Variable_name      | Value   |
+--------------------+---------+
| max_allowed_packet | 67108864|
| net_read_timeout   | 30      |
| net_write_timeout  | 60      |
| wait_timeout       | 28800   |
+--------------------+---------+

Moodle configuration

Server checks

NameInformationReportPluginStatus
moodleOK
unicodeOK
databasemysql (8.0.15)OK
phpOK
pcreunicodeOK
php_extensioniconvOK
php_extensionmbstringOK
php_extensioncurlOK
php_extensionopensslOK
php_extensiontokenizerOK
php_extensionxmlrpcOK
php_extensionsoapOK
php_extensionctypeOK
php_extensionzipOK
php_extensionzlibOK
php_extensiongdOK
php_extensionsimplexmlOK
php_extensionsplOK
php_extensionpcreOK
php_extensiondomOK
php_extensionxmlOK
php_extensionxmlreaderOK
php_extensionintlOK
php_extensionjsonOK
php_extensionhashOK
php_extensionfileinfoOK
php_settingmemory_limitOK
php_settingfile_uploadsOK
php_settingopcache.enableOK

Other checks

InformationReportPluginStatus
mysql_full_unicode_support

The current setup of MySQL or MariaDB is using 'utf8'. This character set does not support four byte characters which include some emoji. Trying to use these characters will result in an error when updating a record, and any information being sent to the database will be lost. Please consider changing your settings to 'utf8mb4'. See the documentation for full details.

Average of ratings: -
In reply to carlos sandoval

Re: Help, I can't read messages dmlreadexception

by Ken Task -
Picture of Particularly helpful Moodlers

'server has gone away' in past has generally meant max_allowed_packets value/setting needs to be increased.  See it's 67.x Meg ... try bumping it up just a little to 70 or 75 M .... then try it again.

Also probably wouldn't hurt (for future upgrades) to address/fix the full compliance issue ... InnoDB, Barracuda, utf8mb4 character set with utf8mb4_unicode_ci, etc.

https://docs.moodle.org/310/en/MySQL_full_unicode_support

'SoS', Ken

In reply to Ken Task

Re: Help, I can't read messages dmlreadexception

by carlos sandoval -
Thank you for your orientation, I updated max_allowed_packet up to 104857600, but error still present.

Looking in to browser´s console i can see that error is localed in xhr post


http://localhost/moodle311/lib/ajax/service.php?sesskey=EYZO3y1REB&info=core_message_get_conversations
with the request payload:

[{"index":0,"methodname":"core_message_get_conversations","args":{"userid":"2","type":1,"limitnum":51,"limitfrom":0,"favourites":false,"mergeself":true}}]

wich response json response is :

[{"error":true,"exception":{"message":"Error al leer de la base de datos","errorcode":"dmlreadexception","backtrace":"* line 486 of \/lib\/dml\/moodle_database.php: dml_read_exception thrown\n* line 1273 of \/lib\/dml\/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 1500 of \/lib\/dml\/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()\n* line 6130 of \/lib\/accesslib.php: call to moodle_database->get_records_select()\n* line 669 of \/message\/classes\/api.php: call to context_helper::preload_contexts_by_id()\n* line 1362 of \/message\/externallib.php: call to core_message\\api::get_conversations()\n* line 261 of \/lib\/externallib.php: call to core_message_external::get_conversations()\n* line 81 of \/lib\/ajax\/service.php: call to external_api::call_external_function()\n","link":"http:\/\/elearning.cepal.org\/moodle\/test\/moodle311\/","moreinfourl":"https:\/\/docs.moodle.org\/311\/es\/error\/moodle\/dmlreadexception","debuginfo":"MySQL server has gone away\nSELECT mdltest_context.id AS ctxid, mdltest_context.path AS ctxpath, mdltest_context.depth AS ctxdepth, mdltest_context.contextlevel AS ctxlevel, mdltest_context.instanceid AS ctxinstance, mdltest_context.locked AS ctxlocked FROM mdltest_context WHERE id IN (?,?) \n-- line 1500 of \/lib\/dml\/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()\n-- line 669 of \/message\/classes\/api.php: call to context_helper::preload_contexts_by_id()\n-- line 1362 of \/message\/externallib.php: call to core_message\\api::get_conversations()\n-- line 261 of \/lib\/externallib.php: call to core_message_external::get_conversations()\n-- line 81 of \/lib\/ajax\/service.php: call to external_api::call_external_function()\n[array (\n 0 => NULL,\n 1 => NULL,\n)]\nError code: dmlreadexception"}}]
In reply to carlos sandoval

Re: Help, I can't read messages dmlreadexception

by carlos sandoval -
I updated max_allowed_packet up to 104857600, but error still present. Looking in to browser´s console i can see that error is localed in xhr post

http://XXXXXX/moodle311/lib/ajax/service.php?sesskey=EYZO3y1REB&info=core_message_get_conversations
with the request payload:

[\{"index":0,"methodname":"core_message_get_conversations","args":{"userid":"2","type":1,"limitnum":51,"limitfrom":0,"favourites":false,"mergeself":true}}]

wich response json response is :

[{"error":true,"exception":{"message":"Error al leer de la base de datos","errorcode":"dmlreadexception","backtrace":"* line 486 of \/lib\/dml\/moodle_database.php: dml_read_exception thrown\n* line 1273 of \/lib\/dml\/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 1500 of \/lib\/dml\/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()\n* line 6130 of \/lib\/accesslib.php: call to moodle_database->get_records_select()\n* line 669 of \/message\/classes\/api.php: call to context_helper::preload_contexts_by_id()\n* line 1362 of \/message\/externallib.php: call to core_message\\api::get_conversations()\n* line 261 of \/lib\/externallib.php: call to core_message_external::get_conversations()\n* line 81 of \/lib\/ajax\/service.php: call to external_api::call_external_function()\n","link":"http:\/\/xxxxxxxxxx\/moodle\/test\/moodle311\/","moreinfourl":"https:\/\/docs.moodle.org\/311\/es\/error\/moodle\/dmlreadexception","debuginfo":"MySQL server has gone away\nSELECT mdltest_context.id AS ctxid, mdltest_context.path AS ctxpath, mdltest_context.depth AS ctxdepth, mdltest_context.contextlevel AS ctxlevel, mdltest_context.instanceid AS ctxinstance, mdltest_context.locked AS ctxlocked FROM mdltest_context WHERE id IN (?,?) \n-- line 1500 of \/lib\/dml\/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()\n-- line 669 of \/message\/classes\/api.php: call to context_helper::preload_contexts_by_id()\n-- line 1362 of \/message\/externallib.php: call to core_message\\api::get_conversations()\n-- line 261 of \/lib\/externallib.php: call to core_message_external::get_conversations()\n-- line 81 of \/lib\/ajax\/service.php: call to external_api::call_external_function()\n[array (\n 0 => NULL,\n 1 => NULL,\n)]\nError code: dmlreadexception"}}]
In reply to carlos sandoval

Re: Help, I can't read messages dmlreadexception

by Ken Task -
Picture of Particularly helpful Moodlers

Even after increasing to suggested (which was a guess), it says:

MySQL server has gone away

updated max_allowed_packet up to 104857600
which is about 100MB.   Did you restart the DB service?

Normally, one also sees in web service error logs 'tried to allocate x bytes' (more).  Does it show that?   It should also show how much it tried to allocate 'byes more'.

Increase value by that many + a little more.

So, one more guess ... 110MB.

If your server is Linux and you can install software, suggest you install MySQL Tuner ... a perl script that will check DB stats and make recommendations for tweaks to my.cnf (config) for DB server.

'SoS', Ken

In reply to Ken Task

Re: Help, I can't read messages dmlreadexception

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Also Carlos: If you are running Moodle 3.10 (Build: 20201109) then your site is six months behind on bug fixes including 19 security fixes. You should update to 3.10.4.