Moodle is hanging every day. Error: Database connection failed

Moodle is hanging every day. Error: Database connection failed

by Tadas Gečas -
Number of replies: 5

Hello,

Moodle version 3.8+ (Build: 20200103) and MySQL version 5.7.32 and using BigBlueButton.

We have logins per day about 2000 and at the same time about 200.

Moodle is hanging every day and display this message "Error: Database connection failed" after restart linux this error disappears and work normally, about a day later this error occurs. What can cause this error? Too many logins at once?

How to solve this trouble? Or resources to increase?

Moodle Error

Average of ratings: -
In reply to Tadas Gečas

Re: Moodle is hanging every day. Error: Database connection failed

by Guillermo Dova -
I'll start checking any error log, from php, apache o get a hint of what may be going on.
Sometimes when this happened to me, disk was full, but may not be your case.
If you want help to diagnose, share your server full specs and moodle details (users, activities, etc)
In reply to Guillermo Dova

Re: Moodle is hanging every day. Error: Database connection failed

by Tadas Gečas -

Hello, 

I add Logs. Moodle got error about 2020-12-09T19:20:00

Thanks for the help

In reply to Tadas Gečas

Re: Moodle is hanging every day. Error: Database connection failed

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
This one?
===
2020-12-09T10:10:07.484459Z 114080 [Note] Aborted connection 114080 to db: 'moodle' user: 'moodleuser' host: 'localhost' (Got an error reading communication packets)
2020-12-09T19:20:00.599248Z 0 [Note] Giving 151 client threads a chance to die gracefully
2020-12-09T19:20:00.599507Z 0 [Note] Shutting down slave threads
2020-12-09T19:20:02.599665Z 0 [Note] Forcefully disconnecting 0 remaining clients
===

Random guess: How large is the MySQL max_allowed_packet?
In reply to Visvanath Ratnaweera

Re: Moodle is hanging every day. Error: Database connection failed

by Tadas Gečas -
mysqld.zip Config is:

key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8

how would you suggest a change? smile
In reply to Tadas Gečas

Re: Moodle is hanging every day. Error: Database connection failed

by Ken Task -
Picture of Particularly helpful Moodlers

In my.cnf ... under the comment # * Fine Tuning

I see

#max_connections        = 100

commented out ... which means server reverts to defaults of 151.

200 is over 151! smile

Mr. V made reference to error logs related to connections.

And, since moodle DB should now be 100% innoDB compliant going forward (Barricuda/etc), would think installing and running MySQLTuner would help you set innodb_buffer_pool_size and innodb_buffer_pool_instances as well as other settings.

'SoS', Ken