This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xxm
Recipients xxm
Date 2020-12-28.04:39:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609130399.05.0.938510382701.issue42763@roundup.psfhosted.org>
In-reply-to
Content
This program is initially from "cpython/Lib/test/crashers/warnings_del_crasher.py" in Python 2.7. The original case is fixed for all version of Python and removed from "crashers" directory. However, if we replace the statement  "for i in range(10):" of original program  with the statement "for do_work in range(10):" . The race will happen again, and it will crash Python 3.7 - 3.10.
==================================================
import threading
import warnings

class WarnOnDel(object):
    def __del__(self):
        warnings.warn("oh no something went wrong", UserWarning)

def do_work():
    while True:
        w = WarnOnDel()

-for i in range(10):
+for do_work in range(10):
    t = threading.Thread(target=do_work)
    t.setDaemon(1)
    t.start()
=================================================


Error messages on Python 3.7-3.10:
-------------------------------------------------------------------------------
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/threading.py", line 960, in _bootstrap_inner
Exception in thread Thread-3:
Traceback (most recent call last):
Exception in thread Thread-4:
  File "/usr/local/python310/lib/python3.10/threading.py", line 960, in _bootstrap_inner
Exception in thread Thread-5:
Traceback (most recent call last):
    self.run()
Traceback (most recent call last):
    self.run()
Exception in thread Thread-6:
Exception in thread Thread-8:
Exception in thread Thread-9:
Exception in thread Thread-10:
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=0x2679180)

Current thread 0x00007f3481d3a700 (most recent call first):
<no Python frame>
Aborted (core dumped)
History
Date User Action Args
2020-12-28 04:39:59xxmsetrecipients: + xxm
2020-12-28 04:39:59xxmsetmessageid: <1609130399.05.0.938510382701.issue42763@roundup.psfhosted.org>
2020-12-28 04:39:59xxmlinkissue42763 messages
2020-12-28 04:39:58xxmcreate