Attached is a simple module. If you try to import it
("import hang"), it prints "asking for temp file", and
hangs there, never returning from its call to
tempfile.TemporaryFile(). It's in fact stuck in
ntpath.py, on the "from nt import _getfullpathname"
line in function `abspath`.
Of course hang.py spawns another thread, and is hung
waiting for the import lock. That thread isn't doing
any imports the _user_ knows about, and Python's
standard library should be coded more defensively than
this.
The symptom was reported on zodb-dev today, where
Martin Gfeller reported ZEO hanging on Windows for what
appears to be the same reason:
http://mail.zope.org/pipermail/zodb-dev/2006-April/009989.html
As it says there, it looks like this problem was
introduced (indirectly) by patch
http://www.python.org/sf/810914
which appears to have been revision 34396 (October
2003! -- but not backported to 2.3, so nobody would
notice this before 2.4).
I haven't dug deeper than this, and don't know why
nobody noticed ZEO hanging before ;-)
|