Sample Header Ad - 728x90

Deadlock on read/wait

1 vote
1 answer
1295 views
My process deadlocks. master looks like this: p=Popen(cmd, stdin=PIPE, stdout=PIPE) for ....: # a few million p.stdin.write(...) p.stdin.close() out = p.stdout.read() p.stdout.close() exitcode = p.wait() child looks something like this: l = list() for line in sys.stdin: l.append(line) sys.stdout.write(str(len(l))) * strace -p PID_master shows that master is stuck in wait4(PID_child,...). * strate -p PID_child shows that child is stuck in read(0,...). How can that be?! **I did close the stdin, why is child still reading from it?!**
Asked by sds (1726 rep)
Aug 3, 2015, 01:12 PM
Last activity: Aug 3, 2015, 03:41 PM