Message201142
I revived my ancient PowerBook G4 just to get to the bottom of this.
The long and short of the issue seems to be that when subprocess.Popen() closes the *read* end of the stdin pipe, fstat() on the *write* end starts failing with EBADF. The exact line where the transition happens is this (aroun subprocess.py#1375):
if p2cread != -1 and p2cwrite != -1 and p2cread != devnull_fd:
os.close(p2cread)
This is clearly a platform bug. I also verified that the child process is still running.
Now I can't reproduce this *without* a fork+exec in the middle, so it may be that there's something magical that's done by the _posixsubprocess.fork_exec() call affecting the pipe, but before the above os.close() call the fstat() call definitely reports success, so the "closing" must be happening as a side effect of closing the other end. I'm sure there's someone at Apple with the kernel source code who can explain this, but I think we've done our due diligence.
That switching to a socketpair fixed the issue suggests that the kernel bug is related to pipes specifically. |
|
Date |
User |
Action |
Args |
2013-10-24 14:51:32 | gvanrossum | set | recipients:
+ gvanrossum, ned.deily |
2013-10-24 14:51:32 | gvanrossum | set | messageid: <1382626292.59.0.275852670427.issue19294@psf.upfronthosting.co.za> |
2013-10-24 14:51:32 | gvanrossum | link | issue19294 messages |
2013-10-24 14:51:31 | gvanrossum | create | |
|