You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spawn() function has this code outside of any error handler:
pid, master_fd = fork()
if pid == CHILD:
os.execlp(argv[0], *argv)
If fork() succeeds, there will actually be a parent Python process and a child Python process. If exec() then fails, an exception will escape the spawn() function in the child process, while the parent process will carry on as if all is well. Maybe it would be worthwhile studying how the “subprocess” module handles exec() failure in the child process.
The patch for bpo-26228 proposes an improvement to the situation, although it is not perfect and does not include a test. I wonder if it is possible to replace fork() and execlp() with a subprocess.Popen invokation, at least in a new Python release?
Activity
niemeyer commentedon Apr 24, 2013
This simple script will spawn N Python interpreters that aren't properly collected due to the improper error handling:
BreamoreBoy commentedon Oct 2, 2014
Can a linux guru comment on this please.
vadmium commentedon Oct 7, 2015
The spawn() function has this code outside of any error handler:
pid, master_fd = fork()
if pid == CHILD:
os.execlp(argv[0], *argv)
If fork() succeeds, there will actually be a parent Python process and a child Python process. If exec() then fails, an exception will escape the spawn() function in the child process, while the parent process will carry on as if all is well. Maybe it would be worthwhile studying how the “subprocess” module handles exec() failure in the child process.
vadmium commentedon Jan 12, 2017
The patch for bpo-26228 proposes an improvement to the situation, although it is not perfect and does not include a test. I wonder if it is possible to replace fork() and execlp() with a subprocess.Popen invokation, at least in a new Python release?