memcached session lock errors

memcached session lock errors

by Susan Mangan -
Number of replies: 2
Moodle v.3.7.7
 
We have been running memcached for application caching successfully for a number of years. We just started to implement session caching on a separate memcached server and are getting session lock errors:
 
We're going to use two memcache servers. One for session caching and one for application caching.
  • test-memcachenv1.cds.capilanou.ca will be used for session caching
  • test-memcachenv2.cds.capilanou.ca will be used for application caching
We tried turning session.lazy_write OFF on both web servers and it seemed like it made a difference at the start but the errors continued to come up.
 
 
Our configuration and errors are below.  Does anyone have any ideas on what to try next?
 
 
[21-Aug-2020 22:16:39 America/Vancouver] PHP Warning:  session_start(): Unable to clear session lock record in /var/www/html/elearn.capu.ca/htdocs/lib/classes/session/handler.php on line 42
[21-Aug-2020 22:16:39 America/Vancouver] PHP Warning:  session_start(): Failed to read session data: memcached (path: test-memcachenv1.cds.capilanou.ca:11211) in /var/www/html/elearn.capu.ca/htdocs/lib/classes/session/handler.php on line 42
[21-Aug-2020 22:16:39 America/Vancouver] Default exception handler: error/An error occurred whilst communicating with the server Debug:
Error code: An error occurred whilst communicating with the server
$a contents:
* line 92 of /lib/classes/session/manager.php: core\session\exception thrown
* line 794 of /lib/setup.php: call to core\session\manager::start()
* line 71 of /config.php: call to require_once()
* line 37 of /my/index.php: call to require_once()
 
 
 
Attachment MicrosoftTeams-image (1).png
Attachment MicrosoftTeams-image.png
Average of ratings: -
In reply to Susan Mangan

Re: memcached session lock errors

by Susan Mangan -
Update: we are running PHP 7.3

Turning off session.lazy_write in php.ini had noticeable effect and we thought problem was resolved but it seems the longer the session + then clicking on participants list over ~100 brought error back.
In reply to Susan Mangan

Re: memcached session lock errors

by Thorsten Bartel -
Picture of Core developers
Hey Susan,

in case you still haven't found a solution, how is your memcached server sized? We had a similar problem (sessions being invalidated) upon switching from file sessions to memcached as session handler.
Turned out, standard config for memcached was something along the lines of 64 MB, which was not close to enough...

If you have something along the lines of "memcached-tool" ( https://github.com/memcached/memcached/blob/master/scripts/memcached-tool ), a Perl-script, installed on your memcached-server:
Observe, whether the output of "./memcached-tool localhost" displays any values above 0 in the "Evicted" column.
Similarly, for "./memcached-tool localhost stats" please compare the values of "bytes" (currently used up memory) vs. "limit_maxbytes" (the maximum allocated memory).

You *should* be able to run memcached-tool on a remote host (e.g. your moodle server) and simply replace "localhost" with "test-memcachenv1.cds.capilanou.ca".

Cheers
Thorsten