2009/7/31 Sam Vilain <sam@vilain.net>: > Sorry. It turns out that the program did indeed have a deadlock > condition. This destruction order change meant that as all of the open > FH, "|-" calls unwound as the program exited, they did it in the > reverse order and this made a real bug in the program happen all the > time. > > So, lessons learned; > > 1. don't use open FH, "|-" if you are setting up complicated > pipelines of many processes; you can't close the FH in processes > which you don't want to be writers on that pipeline, without > potentially deadlocking. > > 2. filehandles started with open FH, "|prog" etc end up having > waitpid() called on them during global destruction, and this too > can cause deadlocks for the above reason. > > 3. always use pipe() and fork() for IPC :) > > I hope that the following doc patch will help transfer my findings to > people trying to do things like this too. > > Subject: [PATCH] pod/perlipc.pod: add some hints on avoiding pipe deadlocks > > Tracking down deadlocks when using pipes for IPC can be hard, so put > even more notes about gotchas in this section of perlipc. Thanks, applied as c40e8e9bf43b15cbc5725b65e3085fba60a67489Thread Previous