Defect #2824
openMySQL Deadlock Error when showing a big repository
0%
Description
First thanks for your great jobs for this application.
I have some problem when I try to connect SVN with Redmine.
Here is the infomation of my system:
CentOS | 5 |
MySQL | 5.0.45 |
ruby | 1.8.5 |
Rails | 2.2.2 |
Redmine | r2521 (I also checked it with 0.8.0) |
SVN | 1.4.2 |
I've added a big SVN repository with 8k of revision and when I go to the repository tab, it show internal error after a long loading time.
I checked the log and it said
ActiveRecord::StatementInvalid (Mysql::Error: Deadlock found when trying to get lock; try restarting transaction: INSERT INTO `changesets`...
The details of the trace is in the attachment.
Then I googled this problem, and it said this problem happen because of the MySQL InnoDB Deadlock detection,
Here is the details
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlock-detection.html
And here are some solutions
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html
I think the InnoDB has a time limit and if a transaction exceed it, the transaction will be aborted and rollbacked.
They said the application should retry the transaction or devide it to some short transactions.
There is a switch to on/off the function, and both the switch and the limit time are defined as system variable of MySQL which can be confirmed like this:
mysql> show variables like 'inno%';
You can find innodb_lock_wait_timeout which is the time limit with a default value 50 (seconds), and innodb_table_locks is the switch which the default value is ON.
I changed the value above by set them in /etc/my.cnf.
First I set the innodb_lock_wait_timeout to a very large number like '99999', but it didn't work. Then I set the innodb_table_locks to 'OFF', and it did work! I can view the repository tab though it still took a long time to load initially.
I don't know if there are some problems when I OFF the table lock function because it seem to be important for the DB and Redmine, Could you give me some solutions?
Sorry for my poor English and thanks for your help.
Files
Related issues