thread.allocate_lock

Tim Peters tim.one at home.com
Wed Jul 18 19:41:25 EDT 2001


[Piers Lauder]
> I'm having problems with threading.

Which OS, which version of Python, which platform-specific flavor of
threads?

> My program occasionally gets errors of the form:
>
> 	Unhandled exception in thread:
> 	Traceback (innermost last):
> 	  File
> "/var/tmp/python-root/usr/lib/python1.5/threading.py", line 392,
> in __bootstrap
> 	  File
> "/var/tmp/python-root/usr/lib/python1.5/threading.py", line 401,
> in __delete
> 	AttributeError: 'None' object has no attribute 'acquire'
>
> ...
> So the only way I can see that it could become None, is if
> allocate_lock() can return None.
>
> Is this possible (without an exception perhaps) eg: when OS resources
> are exhausted?

It should not be possible, no.  If you see these errors when your program is
shutting down (do you?  there's really no info here!), it's possible that
threading.py is in the middle of deconstructing itself and caught in an exit
race.

> If so, line 20 needs a small change.
>
> Anyone else seen this problem before?

I heard of it once before, in an involved app incl. custom C extensions and
some windowing system.  Never resolved.

> PS: I've checked the 2.1 source, and it doesn't appear materially
> different when handling  _active_limbo_lock.

Every release *some* subtle thread races get fixed.  2.1 in particular did
stop some termination races.  Try 2.1.  If it still doesn't go away, whittle
it down to a minimal failing program, if you can.





More information about the Python-list mailing list