Table Locking?

Table Locking?

by Andy Byers -
Number of replies: 9

I’ve come across something quite annoying. We’re about to start moving our Moodle system onto a more powerful machine after a series of issues with the current set up and I’ve been playing around with the test system. When I attempted to update a manual account password I received the following error message:

Timed out while waiting for session lock. Wait for your current requests to finish and try again later.

 

Debug info: 
Error code: sessionwaiterr

 

A quick Show Full Process list on the database shows the following:

db: moodle

Command: Query

Time: 524

State: preparing

Info: DELETE FROM mdl_sessions WHERE userid IN (SELECT id FROM mdl_user WHERE deleted <> 0)

The only thing we’ve done to the database recently was move from a single INNODB file to a file per table setup, has anyone seen this before?

Thanks,

Andy

Average of ratings: -
In reply to Andy Byers

Re: Table Locking?

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

Yes - but I've not managed to find a solution. 

It would be interesting to know what version of Moodle this is?

In reply to Howard Miller

Re: Table Locking?

by Andy Byers -

Its 2.3.

I managed to resolve this by running table optomisations but it still bugs me that it might come back!

-EDIT-

It's back again.

Average of ratings: Useful (1)
In reply to Andy Byers

Re: Table Locking?

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

I can top that - I switched to file-based sessions and still got the error !!

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Table Locking?

by Luis de Vasconcelos -

Howard, sorry for going back so far... Did you ever find the cause of this problem? If so, how did you resolve it?

In reply to Luis de Vasconcelos

Re: Table Locking?

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

Basically, database sessions are unsuitable for high volume sites. With MySQL anyway. The database doesn't seem to be able to keep up.

If you have fast shared storage then use disk based sessions (default), otherwise use memcache/memcached (but not the same instance as MUC). 

Average of ratings: Useful (2)
In reply to Howard Miller

Re: Table Locking?

by Luis de Vasconcelos -

Thanks Howard.

Do "disk based sessions" work in a load-balanced (F5) Moodle environments where you have multiple web servers?

In reply to Luis de Vasconcelos

Re: Table Locking?

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

Somewhat counter-intuitively it seems that they do. The MUC most definitely does not. 

I would probably recommend setting up memcached all the same. Remember, it has to be a completely separate instance from the MUC cache (if you don't want your users randomly logged off)

Average of ratings: Useful (2)
In reply to Howard Miller

Re: Table Locking?

by Luis de Vasconcelos -

So, do I need one instance of Memcached for the MUC cache and another instance of Memcached for the Moodle session management?