pytest-dev / execnet

distributed Python deployment and communication
https://execnet.readthedocs.io
MIT License
78 stars 43 forks source link

More judicious use of file descriptors #71

Open ionelmc opened 6 years ago

ionelmc commented 6 years ago

Currently execnet uses pipes without the CLOEXEC flag. There should be something like this around the parts that make the pipes:

old = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, old | getattr(fcntl, 'FD_CLOEXEC', 1))

Sorry for incredibly-lousy-without-testcase bug report, I'm just at the end of my wits after figuring out my app is littered with subprocess.Popen without close_fds=True :triumph:

ionelmc commented 6 years ago

Actually execnet just uses subprocess.Popen for workers, perhaps setting the CLOEXEC on stdin/out/err in the workers would be good enough?

RonnyPfannschmidt commented 1 year ago

@ionelmc are there any more details on this, im about to change bootstrapping to be more "safe"