[ZODB-Dev] Re: Deadlock in ZODB/DB.py?
Christian Zagrodnick
cz at gocept.com
Tue Oct 10 08:56:58 EDT 2006
On 09.10.2006, at 17:40, Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Christian Zagrodnick wrote:
>> Hi there,
>>
>> the DB.open method makes me wonder how it works
>> (http://svn.zope.org/ZODB/trunk/src/ZODB/DB.py?rev=69551&view=auto)
>>
>> It locks with self._a() and calls self._connectionMap which locks
>> too. I
>> cannot imagine a way this could possibly work.
>>
>> I guess the lock should be released before the _connectionMap call?
>>
>> Interestingly both all the tests pass and ZODB works...
>
> Note the following in the __init__()::
>
> # Allocate lock.
> x = threading.RLock()
> self._a = x.acquire
> self._r = x.release
>
> The lock is a "reentrant" lock[1], which means that subsequent locks
> from within the same thread do not deadlock; instead, they increment
> the lock count.
>
> [1] http://docs.python.org/lib/module-threading.html#l2h-3418
Right. *removing blindfold* This explains something :) Thanks for
the note.
Actually I came to that lock while investigating Ape for ZODB 3.6
where it in some way actually *did* lock. But I'll investigate that
later.
--
Christian Zagrodnick
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2409 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20061010/329f1ef3/smime.bin
More information about the ZODB-Dev
mailing list