Allow me to post the complete code to explain what I see happening. The context is a worker application that watches a beanstalk message queue, forks a child to handle the request and immediately goes back to watching the queue. Let me paste the code and then describe what I see:

When I run this code, here is what I find:
(1) When the messages are coming at intervals of say 10 seconds, run_on_finish is never called.
(2) After the 10th or 12th message or so, suddenly (no pattern that I can discern) run_on_finish is called repeatedly to reap all 10 (or 12) processes that have ended.
(3) Again for about 10/12 messages, no run_on_finish and then suddenly again after 10/12 messages all finished tasks are reaped.
Would appreciate if you could help me understand whats going on

Comment on Re^3: Should I call waitpid when using Parallel::ForkManager to fork in an infinite loop?