[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

Nikolaus Rath report at bugs.python.org
Wed Jan 20 13:12:12 CET 2010


Nikolaus Rath <Nikolaus at rath.org> added the comment:

In this simple example, FUSE does not fork and does not start any threads.

Note that PyGILState_Ensure() cannot do anything here. What happens is this:

 - call_hello.py calls FUSE in a new thread, releasing the GIL.
 - FUSE mounts the file system and waits for requests
 - Meanwhile, in the main thread, call_hello.py calls opendir(), but does not release the GIL
 - FUSE receives the opendir() system call and calls the appropriate callback function
 - If the callback function is implemented in C, everything works fine.
 - If the callback function is implemented in Python, the FUSE thread tries to acquire the GIL to call the (Python) opendir() handler. But it cannot do so, because the GIL is still held by the main thread (which is waiting for the opendir syscall to return) => deadlock.

----------

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


More information about the Python-bugs-list mailing list