STINNER Victor <vstin...@python.org> added the comment:
I wrote 3 scripts to reproduce the bug in a more reliable way. So I just have to type "bisect" and it runs the test 12 times. (1) bisect.bat: --- @"C:\vstinner\python\3.9\PCbuild\amd64\python_d.exe" bisect.py --- (2) bisect.py: --- import subprocess import os import sys BISECT = False def run(*args): print("+ ", ' '.join(args)) env = dict(os.environ) env['PYTHONFAULTHANDLER'] = '1' proc = subprocess.run(args, env=env) exitcode = proc.returncode if exitcode: print() print(f"COMMAND FAILED: {exitcode}") if BISECT: print() print("type: git bisect bad") sys.exit(exitcode) python = sys.executable #script = "win_py399_crash_reproducer.py" script = "bug.py" nrun = 12 for i in range(1, nrun+1): print(f"Run #{i}/{nrun}") if i % 2: run(python, script) else: run(python, "-X", "dev", script) if BISECT: print() print("Not reproduced") print() run("git", "checkout", ".") run("git", "bisect", "good") --- (3) win_py399_crash_reproducer.py (import "_sre"): --- # When this program is run on windows using python 3.9.9 it crashes about 50% # of the time. import _testcapi import threading code = """ import _sre print("exit subinterpreter") """ def doIt(): _testcapi.run_in_subinterp(code) tt=[] for i in range(16): t = threading.Thread(target=doIt) t.start() tt.append(t) for t in tt: t.join() print("exit main") --- Example: --- vstinner@DESKTOP-DK7VBIL C:\vstinner\python\3.9>bisect Run #1/12 + C:\vstinner\python\3.9\PCbuild\amd64\python_d.exe bug.py Run #2/12 + C:\vstinner\python\3.9\PCbuild\amd64\python_d.exe -X dev bug.py Run #3/12 + C:\vstinner\python\3.9\PCbuild\amd64\python_d.exe bug.py Windows fatal exception: access violation (...) Current thread 0x00000420 (most recent call first): File "C:\vstinner\python\3.9\bug.py", line 13 in doIt File "C:\vstinner\python\3.9\lib\threading.py", line 910 in run File "C:\vstinner\python\3.9\lib\threading.py", line 973 in _bootstrap_inner File "C:\vstinner\python\3.9\lib\threading.py", line 930 in _bootstrap (...) COMMAND FAILED: 3221225477 --- ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46070> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com