Using 3.1 on linux.
This script hangs on a CGI POST data read:
#!/usr/bin/python
import sys
data=sys.stdin.read();
print "Content-type: text/plain\r\n\r\n"
print "input was:...'", data, "'No more input"
If you ls -l on /proc/<child_pid>/fd, you can see too many fds are open for the
child process. We should only see 0, 1, and 2 open.
# ls -l fd
total 0
lr-x------ 1 evaitl evaitl 64 2012-07-20 10:33 0 -> pipe:[1789951]
l-wx------ 1 evaitl evaitl 64 2012-07-20 10:33 1 -> pipe:[1789952]
l-wx------ 1 evaitl evaitl 64 2012-07-20 10:32 2 -> pipe:[1789952]
l-wx------ 1 evaitl evaitl 64 2012-07-20 10:33 5 -> pipe:[1789951]
lr-x------ 1 evaitl evaitl 64 2012-07-20 10:33 6 -> pipe:[1789952]
lrwx------ 1 evaitl evaitl 64 2012-07-20 10:33 9 -> socket:[1788436]
After looking at the code, it appears that the write side of the child's stdin
fd is open and passed to the child process. Because of this, the child never
sees the EOF on stdin and hangs while reading data.
Also, the parent process needs to close the write side of this pipe after
forwarding the POST data.
My local fix has been added in branch evaitl-cgipost
Original issue reported on code.google.com by eva...@gmail.com on 20 Jul 2012 at 2:39
Original issue reported on code.google.com by
eva...@gmail.com
on 20 Jul 2012 at 2:39