Project

General

Profile

Actions

Defect #2824

open

MySQL Deadlock Error when showing a big repository

Added by Minjie Zhu about 15 years ago. Updated almost 9 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-02-24
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

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

trace.log (10.7 KB) trace.log this is the trace log and I edited some contents for privacy Minjie Zhu, 2009-02-24 14:27
innodb_status_full.txt (19.1 KB) innodb_status_full.txt output of show innodb status Minjie Zhu, 2009-02-25 01:55

Related issues

Related to Redmine - Defect #13086: "Mysql::Error: Duplicate entry" in fetching revisionsNeeds feedback

Actions
Related to Redmine - Defect #13592: ActiveRecord::RecordNotUnique for git repositoryNew

Actions
Related to Redmine - Defect #13744: Redmine hangs up with large repoClosed

Actions
Related to Redmine - Defect #1931: Timeout risks: need asynchronous operationsNew2008-09-22

Actions
Actions

Also available in: Atom PDF