Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Managing the fork/execing and reaping of child processes

by QM (Parson)
on Jul 16, 2015 at 15:46 UTC ( [id://1135037]=note: print w/replies, xml ) Need Help??


in reply to Managing the fork/execing and reaping of child processes

Perhaps not the issue, but ++$active_readers should be later in the parent, after checking if the fork was successful.

Why the exec in line 47? You could just as easily print from perl.

What system are you running on? I'm guessing there's a fork limit or something involved, and the perl script isn't getting any CPU or IO cycles, and is hanging there. Have you checked the CPU usage? Have you considered tracing the execution, and finding the last line executed before the hang?

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: Managing the fork/execing and reaping of child processes
by ibm1620 (Hermit) on Jul 16, 2015 at 15:53 UTC
    In the real program, I exec a C program. I just wanted to keep differences to a minimum in this stripped-down version.

    I will look into the $active_readers question.

      System is CentOS. I don't know what kind of PID limits there are. When the freeze occurs, there's no CPU being used on the box (I'm the only occupant currently). There are no zombies. What are you referring to by "tracing"?
        "Tracing" could be something as simple as sprinkling
        print STDERR "This is line ", __LINE__, "\n"

        most everywhere, to using the debugger with actions on interesting lines, to one of the modules that wraps around the bytecode.

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Re^2: Managing the fork/execing and reaping of child processes
by ibm1620 (Hermit) on Jul 16, 2015 at 16:04 UTC
    Moving ++$active_readers didn't help (not surprisingly; if the fork were to fail, my program would exit).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-03-28 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found