Project

General

Profile

Actions

Defect #19040

closed

Potential DB deadlocks on concurrent issue creation

Added by Serghei Zagorinyak about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Database
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

We're running Redmine 2.5.0 with approx 120 users backed by an MS SQL database. The problem we have encountered is that from time to time issue creation fails because of DB deadlocks.
To reproduce this we created a python script that would start 7 threads and fire POST requests to create new issues in Redmine. Pretty soon 6 out of 7 threads were dead because of deadlocks on issue validation.

TinyTds::Error: Transaction (Process ID 227) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.: EXEC sp_executesql N'SELECT [issues].* FROM [issues] WHERE [issues].[parent_id] = 22244 ORDER BY [lft] ASC'
Issue Load (5027.7ms) EXEC sp_executesql N'SELECT [issues].* FROM [issues] WHERE [issues].[parent_id] = 22244 ORDER BY [lft] ASC'

After that we turned on READ_COMMITTED_SNAPSHOT option in DB that allows to read transaction data even if it hasn't been committed yet, and this helped us move one step forward: deadlocks began to happen on INSERTs when new issues were to be created. Still it didn't help to solve the problem.

Is it possible to soften lock conditions or reduce transaction sizes as obviously concurrency suffers from that?


Related issues

Related to Redmine - Feature #18860: Replace awesome_nested_set gem with a custom implementation of nested setsClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #6579: Tree hierachy being currupted on multiple submissions of an issueClosedJean-Philippe Lang2010-10-05

Actions
Actions

Also available in: Atom PDF