Welcome Guest, Not a member yet? Register   Sign In
Database deadlock, error 1213
#1

[eluser]little brittle[/eluser]
I am getting an error on my site every now and then with a database deadlock. Here is the complete text of the error:

Code:
Error Number: 1213

Deadlock found when trying to get lock; try restarting transaction

UPDATE `ci_sessions` SET `last_activity` = 1237826089, `session_id` = '330605bba43ff0de03899f68a2de144a' WHERE session_id = 'e64f09136bab7b31ce129084c8453332'

How can I avoid this?
#2

[eluser]pistolPete[/eluser]
Which CI version and which datbase driver are you using?
#3

[eluser]little brittle[/eluser]
I should have mentioned that, sorry. CI 1.7.1 using MySQL.
#4

[eluser]TheFuzzy0ne[/eluser]
I think this might be an issue with your host. They probably aren't running the latest stable version of MySQL.

There's a bug report [url="http://bugs.mysql.com/bug.php?id=27967"]here[/url], but it suggests that the problem has something to do with transactions, which the sessions class does not use.

Are you using InnoDB and not MyISAM? If so, I'd suggest using MyISAM instead.
#5

[eluser]slowgary[/eluser]
@TheFuzzyOne

Sorry to resurrect this old post. I'm facing the same deadlock problem. With the number of writes to the sessions table, won't MyISAM perform much worse than InnoDB? Obviously, throwing fatal errors is worse than poor performance, but I'd really like to avoid table-level locking on sessions, it really seems bad.




Theme © iAndrew 2016 - Forum software by © MyBB