in reply to Script hangs when called via IPC::Open3

I'm trying this on FreeBSD, perl 5.8.8 without theads, and it hangs for me on a different value: somewhere between 15000 and 16000.

But when I move the wait() call to the end of the script, thus below the reading of the handles, it never hangs, not even with a value like 200000 2 million.

I think your buffer space is full, so the writer gets blocked, and wait effectively waits forever, because you never start reading — the writer is blocked forever.

Replies are listed 'Best First'.
Re^2: Script hangs when called via IPC::Open3 (Problem)
by ikegami (Patriarch) on Jun 27, 2006 at 22:26 UTC

    That's exactly it. Here's the problem in graphical form, in case it helps:

    +---------------------+----------------------+ | Parent | Child | +---------------------+----------------------+ | - open3(...); | | | - wait(); | - ... | | | - Waits for child | - print 1027; | | | to end. | - print 1028; | | | | - print 1029; | T | | - print 1030; | i | | - print 1031; | m | | - Pipe full. | e | | Waits for parent | | | | to empty it. | | | | | v | Still waiting... | Still waiting... | +---------------------+----------------------+

    When I see open3, I expect to see an IO::Select object.