[issue10923] Deadlock because of the import lock when loading the utf8 codec

Antoine Pitrou report at bugs.python.org
Thu Jan 20 14:07:41 CET 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> If it is impossible to detect deadlocks, can't we raise an exception
> if two threads try to import a module at the same time? (change
> completly how the import "lock" is handled)
> 
> Antoine changed recently the io module to raise a RuntimeError on
> reentrant calls in the io module (io.Buffered*.*()): #10478.

Reentrant calls and concurrent calls are not the same. If the import
lock is changed to raise an exception, heaps of multi-threaded software
will be broken.

What we could do is set a timeout on the import lock, but then we need
to choose a rather large one (e.g. 5 minutes), and who will wait 5
minutes before killing the process?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10923>
_______________________________________


More information about the Python-bugs-list mailing list