Redis session caching locks?

Redis session caching locks?

by Vaesar Rodriguez -
Number of replies: 3

We're looking to deploy redis for session caching, however we're running into the "Unable to obtain session lock" error fairly regularly.

I'm able to generate this issue fairly regularly just by navigating to my own user profile.

Anyone else that's implemented Redis sessions run into this before? If so, how did you resolve it?

Average of ratings: -
In reply to Vaesar Rodriguez

Re: Redis session caching locks?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There is a slightly longer message written to the error log too. I'm a bit out of my depth with session locking but the id may help to identify the root of the problem. 

                if ($this->time() > $startlocktime + $this->acquiretimeout) {
                    // This is a fatal error, better inform users.
                    // It should not happen very often - all pages that need long time to execute
                    // should close session immediately after access control checks.
                    error_log('Cannot obtain session lock for sid: '.$id.' within '.$this->acquiretimeout.
                            '. It is likely another page has a long session lock, or the session lock was never released.');
                    throw new exception("Unable to obtain session lock");
                }
In reply to Vaesar Rodriguez

Re: Redis session caching locks?

by Vikram Solia -

Hi Vaesar,

Also afflicted with the same issue. Looks like this might be the culprit: https://tracker.moodle.org/browse/MDL-55953

Were you able to resolve it?

Anybody else encountering this issue?

In reply to Vikram Solia

Re: Redis session caching locks?

by Vaesar Rodriguez -

We gave up on Redis for now and will revisit at a later point. We were originally investigating implementing Redis due to some memcached issues we were having, but managed to resolve those so put Redis on the back burners.