open() blocks the thread, but only in a module, until the main module is ...finished?

Issue #2179 resolved
cy created an issue

When I try to open a file in a thread, the call to open() blocks, until my main thread has fallen off and run out of code. There's a secret lock somewhere, causing any threads to block until the main one has exited. This only happens if that second thread is started from a module. If a thread is started from code in the main file, it doesn't block on open() and works as expected.

It produces a deadlock if the main thread depends on any results from the thread subsequent to that call to open(), severely limiting what I/O a thread can do, with the main thread blocking all open() calls from completing.

Tried it on pypy3, not a problem on pypy2 apparantly. Python 3.2.5 (6da866a9e7d5+, Dec 03 2015, 21:03:38) [PyPy 4.0.1-alpha0 with GCC 5.2.0]

Comments (4)

  1. Log in to comment