Dead lock

I have been using CellProfiler for quite some time without major problems. Recently I moved to batch processing to speed up things. When I run 9 instances of CellProfiler (all on one machine, windows server) I regularly get a MySQL dead lock. It looks like the CellProfiler makes only one attempt to write the data and quits when it fails. Is it possible to have it try writing the data a few times before aborting the run?

Thanks

Coen

log:

Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.

C:\Users\kuijlc>CD\Program Files\CellProfiler

C:\Program Files\CellProfiler>CellProfiler -p K:\2011-04-27-Nikon_rm153055\plate
1\output\Batch_data.mat -c -r -f141 -l160
Load ilastik Core
Adding Hessian matrix of Gaussian to Group Orientation
Adding Eigenvalues of Hessian matrix of Gaussian to Group Texture
Adding Eigenvalues of structure tensor to Group Texture
Adding Gradient Magnitude of Gaussian to Group Edge
Adding Gaussian Smoothing to Group Color
Adding Structure Tensor to Group Orientation
Adding Laplacian of Gaussian to Group Edge
Adding Difference of Gaussians to Group Edge
Loaded classifier: Random forest classifier
Loaded classifier: Random forest classifier (stable)
Loaded classifier: Random forest classifier with variable importance
Subversion revision: 10997
Thu Apr 28 13:11:52 2011: Image # 141, module LoadImages # 1: 5.52 sec (bg)
Thu Apr 28 13:11:55 2011: Image # 141, module LoadData # 2: 0.00 sec (bg)
Thu Apr 28 13:11:55 2011: Image # 141, module IdentifyPrimaryObjects # 3: 22.17
sec (bg)
Thu Apr 28 13:12:17 2011: Image # 141, module ExpandOrShrinkObjects # 4: 1.89 se
c
Thu Apr 28 13:12:19 2011: Image # 141, module IdentifyTertiaryObjects # 5: 1.37
sec
Thu Apr 28 13:12:20 2011: Image # 141, module MeasureObjectIntensity # 6: 5.30 s
ec (bg)
Thu Apr 28 13:12:26 2011: Image # 141, module MeasureObjectSizeShape # 7: 32.12
sec (bg)
Thu Apr 28 13:12:58 2011: Image # 141, module MeasureTexture # 8: 33.93 sec (bg)

Thu Apr 28 13:13:32 2011: Image # 141, module CalculateMath # 9: 0.02 sec (bg)
Traceback (most recent call last):
File “cellprofiler\modules\exporttodatabase.pyc”, line 1740, in write_data_to_
db
File “MySQLdb\cursors.pyc”, line 206, in executemany
File “MySQLdb\cursors.pyc”, line 174, in execute
File “MySQLdb\connections.pyc”, line 36, in defaulterrorhandler
OperationalError: (1213, ‘Deadlock found when trying to get lock; try restarting
transaction’)
Traceback (most recent call last):
File “cellprofiler\pipeline.pyc”, line 1134, in run_with_yield
File “cellprofiler\modules\exporttodatabase.pyc”, line 1017, in run
File “cellprofiler\modules\exporttodatabase.pyc”, line 1740, in write_data_to_
db
File “MySQLdb\cursors.pyc”, line 206, in executemany
File “MySQLdb\cursors.pyc”, line 174, in execute
File “MySQLdb\connections.pyc”, line 36, in defaulterrorhandler
OperationalError: (1213, ‘Deadlock found when trying to get lock; try restarting
transaction’)
Thu Apr 28 13:13:32 2011: Image # 141, module ExportToDatabase # 10: 3.06 sec

Hi Coen,
Do you know which MySQL database engine you’re using? We’ve been using MyISAM here, unfortunately, which is not transactional. Also, we don’t disable autocommit which, I think, is on by default which would mean that we commit after every transaction. I’m testing deadlocks right now with InnoDB which has row-level locking and haven’t been able to recreate a problem. There should not be any deadlocks unless you analyze the same image set on two different machines simultaneously. Even there, we designed the database code to avoid deadlocks, although I can see one possible problem area.

I’ll try some more to see if I can recreate the problem (and then solve it, right?) and get back to you.

–Lee

Hi Lee,

I am using all the standard settings when you install MySQL (MyISAM). I also did not analyse the same image set twice on different machines. Lately, I haven’t encounterd the problem anymore, while nothing has changed in respect to the software I am using. So it is quite difficult to say what might have resolved the problem.

Coen