Python's subprocess.Popen's close_fds option is notoriously slow (see https://bugs.python.org/issue8052 and note that the issue is only fixed for systems that mount fdescfs, which isn't all of them ). Using fstat, I see that just before calling subprocess.Popen there are no file descriptors open whatsoever
$ sudo fstat -p 23537
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root python3.7 23537 text / 305521 -r-xr-xr-x 15280 r
root python3.7 23537 ctty /dev 1987 crw--w---- pts/0 rw
root python3.7 23537 wd /usr/home 688140 drwxr-xr-x 23 r
root python3.7 23537 root / 4 drwxr-xr-x 60 r
Accordingly, I suggest setting close_fds = False to improve performance on systems that don't mount fdescfs.
Python's
subprocess.Popen
'sclose_fds
option is notoriously slow (see https://bugs.python.org/issue8052 and note that the issue is only fixed for systems that mount fdescfs, which isn't all of them ). Usingfstat
, I see that just before callingsubprocess.Popen
there are no file descriptors open whatsoeverAccordingly, I suggest setting
close_fds = False
to improve performance on systems that don't mountfdescfs
.