Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use close_fds with subprocess.Popen #33

Open
asomers opened this issue Feb 11, 2020 · 1 comment
Open

Don't use close_fds with subprocess.Popen #33

asomers opened this issue Feb 11, 2020 · 1 comment

Comments

@asomers
Copy link

asomers commented Feb 11, 2020

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.

@nobody43
Copy link
Owner

It was necessary for process spawning earlier. Let's try to do it your way since the timeout is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants