2010/4/19 marius zbihlei marius.zbihlei@1and1.ro:
Hello I have attached to this email a new main.c.patch containing the select changes (timeout is 30 seconds, hard coded :) )
It's ok for me, I don't consider that this value should be a configurable parameter. I've also seen you have fixed a bug of mine since I closed twice the fd[0] in the main (child) process :)
I have taken the liberty to also format your initial patch.
Great. However I see a diff for modules/carrierroute/cr_func.c ¿? :)
But if we just kill the main process from the parent process, then all the workers and rest of children would be killed, right? The problem would be if the main process gets "blocked" for some reason, but I think that is a terrible case I've never seen.
I have not yet provide with a solution for this case. If the select timeout is finished, then the main process will try to write to a pipe that the other end stop reading, receive EPIPE and kill all its children. This is the case in witch the main process reaches the write part, if it's blocked somewhere else... well this must be taken care of.
Perhaps the parent process could return a different error code (i.e. -2) if pipe read timeout occurs so the init script could then do a kill -9 (problem, parent process doesn't know the main process PID). Well, I think this is an already existing issue even without these changes. For sure there are more corner cases to handle but I do think that this patch is a real improvement over the current code, am I right? :)
Thanks a lot.