[python-ldap] mutex bug in 2.4.4

Michael Ströder michael at stroeder.com
Wed Nov 23 12:24:54 CET 2011


Side note: Mailing list python-ldap at python.org only accepts postings by
subscribers. I had to manually approve your posting. So please subscribe to
the mailing list if you want to follow the discussion.

Malinowski, Adam wrote:
> There appears to be a bug in stable 2.4.4 version of python-module when used
> in multi-threaded python environment.  I haven’t found any info on the mailing
> list about this, so I thought it should be reported.
> A different object is used in lock acquire() and release(), which leads to
> call to release() always fail, also other blocked callers could be stuck
> forever. 

How did you come to this conclusion? Do you have a traceback of the calls?

> Perhaps the change was never tested in multi-threaded python.

My web2ldap is a multi-threaded web app where the same LDAPObject instances
get possibly used by multiple threads. IMO it works as designed. Not sure
whether this hits all locking conditions though.

> Falling back to using the global module mutex lock seems to fix it.

Sorry, your patch does not make sense to me. _ldap_function_call() takes an
instance of threading.Lock or compatible. If lock is None no locking is done.
Your patch completely changes that behaviour and also you're not releasing

Ciao, Michael.

More information about the python-ldap mailing list