Dear All,
While our Moodle installation generally works well, about once a month at least, even in the dead of night when there are few users online, we get an alarm telling us the number of mysql sessions (currently 300 concurrent) have run out.
This evidently happens when the following mysql enquiry in touch_session() in /lib/classes/manager.php is requested:
UPDATE mdl_sessions SET timemodified = 'unix time string' WHERE id='user_id'
From what I can gather this is called from the following chain of invocations in Moodle:
1. /auth/mnet/auth.php
keepalive_client()
- used to poll the IdP server to let it know that a user it has authenticated is still online.
2. /auth/mnet/auth.php
keepalive_server()
- which process 30 users at a time from the remote DB, and then invokes the touch_session on each of them.
3. /lib/classes/manager.php:
touch_session()
- used to refresh the session of the user.
Presumably this chain of events happens pretty constantly during natural Moodle uptime but like I said, on occasion the call gets propagated along all the available mysql sessions, getting passed from one session down to next available putting each session in turn into a 'sleep' state making it unavailable for other users. In end all sessions are used up.
Does anyone have any experience or insight into this? Or provide a workround. A try and catch statement around the offending enquiry in the moodle source? But surely, others would have noticed something similiar too.
Your hopefully,
ian