-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting intermittent deadlocks on regenerateSession #106
Comments
I think what is happening is a SQL query is running somewhere that is holding a record lock on the record (or many records) in the session table. Then when you execute regenerate on that session, it gives you that lock error. I suspect that it could be caused by the interval to clear expired sessions - by default this runs every 15 minutes but it looks like you've got it set to run once per hour. Try running your app with About how many rows does your sessions table have typically? |
We have this same issue intermittently. I haven't set any configuration values other than the db+login. Our sessions table has millions of rows - but we only have a few thousand users. Can this be solved via configuration? |
If you have millions of sessions with only a few thousand users, then I suspect you have a very very long expires time (e.g 1 year). If that's the case, then you might try setting the "clearExpired" option to false. And also it might be a good idea to not use sessions for clients (browsers) that are not logged in (guests), unless you maintain state on your server for such guest users. |
Hello!
Firstly, thank you for taking the time to maintain this library, it has been very helpful to me.
As per the docs, I use an external connection pool (sidorares/mysql2) when I instantiate this library:
For the most part it seems to work great.
However, intermittently in my code, when I then call req.session.regnerate() I get the following deadlock:
Any ideas?
The text was updated successfully, but these errors were encountered: