Closed
Description
Bug report
The atexit handler registered in _create_tmp_config_or_cache_dir
to cleanup the newly created tmp dir is inherited by child processes. When these child processes exit the tmp dir is cleaned up while the parent process is still trying to use it.
In particular when the parent process itself exits and attempts to cleanup the dir it hits this error:
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.5/shutil.py", line 469, in rmtree
orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/matplotlib-3z9ovc1y'
Code for reproduction
import os
import time
import pathlib
# Del MPLCONFIGDIR, and override pathlib.Path.home so matplotlib will call _create_tmp_config_or_cache_dir()
if("MPLCONFIGDIR" in os.environ):
del os.environ["MPLCONFIGDIR"]
pathlib.Path.home = lambda: "/dev/null"
import matplotlib
pid = os.fork()
if(pid != 0):
time.sleep(1) # Parent sleeps to allow child to exit first
Metadata
Metadata
Assignees
Labels
No labels