STINNER Victor <vstin...@redhat.com> added the comment:

I wrote PR 13889: with this change, I can easily reproduce the crash on Linux:

$ ./python -m test test_threading -m test_threads_join_2 -F
Run tests sequentially
0:00:00 load avg: 0.51 [  1] test_threading
Fatal Python error: Py_EndInterpreter: not the last thread

Current thread 0x00007f84ad74d740 (most recent call first):
  File "/home/vstinner/prog/python/master/Lib/test/support/__init__.py", line 
2794 in run_in_subinterp
  File "/home/vstinner/prog/python/master/Lib/test/test_threading.py", line 923 
in test_threads_join_2
...

Py_EndInterpreter() calls wait_for_thread_shutdown() to wait until 
threading._shutdown() completes.

When the assertion fails, threading.enumerate() only contains the main thread: 
the spawned thread is already gone. But the assertion fails, which means that 
the Python thread state of the thread (which looks to be completed) is still 
around.

This unit test comes from bpo-18808:

commit 7b4769937fb612d576b6829c3b834f3dd31752f1
Author: Antoine Pitrou <solip...@pitrou.net>
Date:   Sat Sep 7 23:38:37 2013 +0200

    Issue #18808: Thread.join() now waits for the underlying thread state to be 
destroyed before returning.
    This prevents unpredictable aborts in Py_EndInterpreter() when some 
non-daemon threads are still running.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36402>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to