Issue 30170: "tests may fail, unable to create temporary directory" warning on buildbot: add a cleanup step to buildbots (original) (raw)
On buildbots, it's common to see such warning:
0:32:04 [269/404] test_property passed -- running: test_multiprocessing_spawn (74 sec) D:\buildarea\3.x.bolen-windows10\build\lib\test\support_init_.py:1012: RuntimeWarning: tests may fail, unable to create temporary directory 'D:\buildarea\3.x.bolen-windows10\build\build\test_python_1048': [WinError 183] Cannot create a file when that file already exists: 'D:\buildarea\3.x.bolen-windows10\build\build\test_python_1048' with temp_dir(path=name, quiet=quiet) as temp_path: running: test_cmd_line_script (30 sec), test_multiprocessing_spawn (104 sec)
I also got it sometimes. It took me months to understand where it does come from.
It's quite stupid in fact: temporary directories are not removed if a test does crash (ex: segfault). Later, if a test process has the same PID than the crashed process, you get the warning.
I suggest to add a "clean" step on buildbots to first remove old "test_python_*" directories leaked by previous runs.
First, I wanted to add such cleanup in regrtest directly, but it's common that I run two main regrtest processes in parallel, and I would like to keep this feature. If regrtest starts by removing test_python_*: it will break currently running tests.
I'm not 100% confident that the warning is caused by previous runs, but I think that it's worth it to try to cleanup to check if it's case ;-)
I got this error trying to build Python 3.6.7, why is this closed?
Running PGInstrument|x64 interpreter... E:\RepoGiT\3.6\lib\test\support_init_.py:1029: RuntimeWarning: tests may fail, unable to create temp dir: D:\Users\yorch\AppData\Local\Temp\test_python_15660 with temp_dir(path=name, quiet=quiet) as temp_path: Run tests sequentially