Bug #28073 Infinite loop in lock queue
Submitted: 24 Apr 2007 13:32 Modified: 30 Apr 2007 9:11
Reporter: Kristian Nielsen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.1-bk OS:Any
Assigned to: Kristian Nielsen

[24 Apr 2007 13:32] Kristian Nielsen
Description:
Infinite loop in ACC lock queue in some (rare) cases.

Seems to be triggered by

T1 has read lock on tuple.

T2 takes read lock + T1 tries to get write lock, on same tuple in same signal batch.

How to repeat:
This is triggered by the test case in testBlobs for BUG#27370.
Was not able to reproduce with a simple non-blob test case.

Suggested fix:
Patch by Jonas:

===== DbaccMain.cpp 1.82 vs edited =====
--- 1.82/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2007-04-24 12:41:44 +02:00
+++ DbaccMain.cpp	2007-04-24 12:41:36 +02:00
@@ -1320,8 +1320,7 @@
   /**
    * We must check if there are many transactions in parallel queue...
    */
-  OperationrecPtr tmp;
-  tmp.i = loPtr.p->nextParallelQue;
+  OperationrecPtr tmp = loPtr;
   while (tmp.i != RNIL)
   {
     ptrCheckGuard(tmp, coprecsize, operationrec);      
@@ -1333,6 +1332,7 @@
        */
       return;
     }
+    tmp.i = tmp.p->nextParallelQue;
   }
   
 upgrade:
[24 Apr 2007 14:06] Jonas Oreland
manage to reproduce loop
with patched test prg and patched ndbd

will "clean up" testcase

/Jonas
[25 Apr 2007 12:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25396

ChangeSet@1.2458, 2007-04-25 14:38:05+02:00, knielsen@ymer.(none) +5 -0
  BUG#28073: Infinite loop in lock queue.
  
  In a certain code path the NDBD could loop infinitely in the lock queue.
[25 Apr 2007 19:09] Kristian Nielsen
Pushed to mysql-5.1-new-ndb and mysql-5.1-telco-gca.
[28 Apr 2007 19:35] Bugs System
Pushed into 5.1.18-beta
[30 Apr 2007 9:11] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.18 changelog.