[ZODB-Dev] Re: Deadlock in ZODB/DB.py?
Tres Seaver
tseaver at palladion.com
Mon Oct 9 11:40:27 EDT 2006
-----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
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFKm1r+gerLs4ltQ4RAkmjAKCQFc0CwZeWRmffajADcHqBpsY9qQCguZ12
1dFN7jpri+CtgfiGR86zH7w=
=uhXI
-----END PGP SIGNATURE-----
More information about the ZODB-Dev
mailing list