[ZODB-Dev] deadlock prevention for ZODB3 / Zope 2.6

Shane Hathaway shane@zope.com
Wed, 13 Nov 2002 10:08:29 -0500


Chris Withers wrote:
> Jeremy Hylton wrote:
> 
>> We recently discovered that ZODB3 applications, like Zope 2.6, can
>> deadlock when run in a system that uses multiple storages.  This was a
>> fundamental design flaw in ZODB that, happily, has a simple fix.
> 
> 
> Would this fix also help with this problem:
> 
> http://sourceforge.net/tracker/index.php?func=detail&aid=550246&group_id=15628&atid=115628 

No.  In your case, the transaction tries to acquire the same lock twice, 
which is a deadlock.  The normal solution for this is a reentrant lock, 
which would be possible to do (using a transaction ID instead of the 
thread ID to discover when a lock is being acquired more than once), but 
it's not likely to be worth the effort.  You can structure your 
application in such a way that this never happens.  Don't open two 
ClientStorages that point to the same StorageServer.

Shane