I'm able to reliably reproduce this on a RHEL 5 box (i386 in this case).
All of the "ProcessPool*" unittest subclasses within Lib/test/test_concurrent_futures.py exhibit this hang, each printing out just the name of the first test (so presumably either within the first test method, or in shared setup/teardown).
None of the other subclasses hang.
You need to build with --with-pydebug to see this: the error message is coming from this code in PyThreadState_Swap in Python/pystate.c:
390 #if defined(Py_DEBUG) && defined(WITH_THREAD)
391 if (newts) {
392 /* This can be called from PyEval_RestoreThread(). Similar
393 to it, we need to ensure errno doesn't change.
394 */
395 int err = errno;
396 PyThreadState *check = PyGILState_GetThisThreadState();
397 if (check && check->interp == newts->interp && check != newts)
>>>398 Py_FatalError("Invalid thread state for this thread");
399 errno = err;
400 }
401 #endif |