[issue44105] tempfile.TemporaryDirectory deleted after call to subprocess.run in threads
New submission from Colas Le Guernic : Yet another weird bug when one creates sub-processes from threads. I found several issues mentioning ThreadPoolExecutor and subprocess.run but I believe this one is different. When creating a temporary directory with tempfile.TemporaryDirectory (with or without context manager) it is sometimes deleted by a call to subprocess.run when both occurs inside a task sent to a ThreadPoolExecutor created without a context manager (that last part is very odd). Running the attached file on python 3.8.5 or 3.8.10 shows the issue only occurs if the executor is not created through a context manager. The bug does not seem to occur on python 3.9.5 or 3.10.0b1. Using a ProcessPoolExecutor seems to fix the issue too. -- files: test_tmpdir.py messages: 393436 nosy: colas.le.guernic priority: normal severity: normal status: open title: tempfile.TemporaryDirectory deleted after call to subprocess.run in threads type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file50035/test_tmpdir.py ___ Python tracker <https://bugs.python.org/issue44105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44105] tempfile.TemporaryDirectory deleted after call to subprocess.run in threads
Change by Colas Le Guernic : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue44105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44105] tempfile.TemporaryDirectory deleted after sleep in threads
Colas Le Guernic added the comment: Actually, it has nothing to do with subprocess.run, replacing that line with sleep(random()) exhibits the same behavior. -- title: tempfile.TemporaryDirectory deleted after call to subprocess.run in threads -> tempfile.TemporaryDirectory deleted after sleep in threads Added file: https://bugs.python.org/file50036/mwe.py ___ Python tracker <https://bugs.python.org/issue44105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44105] tempfile.TemporaryDirectory deleted after sleep in threads
Change by Colas Le Guernic : -- versions: +Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue44105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44105] tempfile.TemporaryDirectory deleted after sleep in threads
Colas Le Guernic added the comment: I guess this will be a `won't fix` as python3.8 is now in security-fix only mode. I was misled by https://www.python.org/downloads/ that still indicates a bugfix maintenance status. -- ___ Python tracker <https://bugs.python.org/issue44105> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com