[18:16] <econnell> i'm trying to create a config for apache traffic server, and it behaves a bit odd.  you exec a program called traffic_cop which then spawns 2 other processes.  Is there a way to wait for all processes within the process group to terminate before declaring the job as stopped?  (running upstart 1.5-0ubuntu7)
[18:19] <SpamapS> econnell: does traffic_cop stay resident? if so, thats the process/group that will be tracked
[18:20] <econnell> yes, it does stay resident and it does not daemonize (i.e. no expect statement in the config)
[18:20] <SpamapS> then that should behave as you'd expect.. kill to the process group
[18:20] <econnell> is that the default behavior?  to wait for all members of the process group before stopping?
[18:21] <econnell> yes, i see the kill signal is sent to the group, but it appears to only wait for the main tracked process to stop rather than all processes in the group (i think... it's hard to tell)
[18:23] <SpamapS> yeah I'm tracking down how job_process_terminate is called
[18:24] <SpamapS> getting into libnih at that point
[18:24] <SpamapS> econnell: ultimately traffic_cop should be killing and waiting for its own children...
[18:24] <SpamapS> econnell: this is just a question of cleaning up and timing I guess
[18:26] <SpamapS> econnell: it looks to me like only the main process would be waited on
[18:27] <SpamapS> econnell: I believe if traffic_cop exits without waiting for its children, pid 1 will inherit them as zombies and then they'll be cleaned up in the normal zombie cleanup way
[18:29] <econnell> yeah... that's happening, the actual problem i'm trying to solve is with restarting the job... the timing causes it to occasionally try to start traffic_cop before the children are killed, which causes some other weird problems
[18:30] <econnell> is there a way to determine what the pgid that's being tracked is in a script?  if so, i could hack a post-stop script that waits i suppose
[18:38] <SpamapS> econnell: pgid == parent pid
[18:38] <SpamapS> econnell: post-stop doesn't get called in the 'restart' action btw.. 
[18:40] <econnell> interesting... i assumed restart == stop, then start... 
[18:55] <econnell> SpamapS: are you sure about that?   during restart i see: init: Handling stopping event
[19:09] <SpamapS> econnell: stopping yes, but I don't believe post-stop is the next step
[19:09] <SpamapS> restart is a little wonky
[19:10] <SpamapS> pre-stops aren't run
[19:39] <econnell> SpamapS: alright... i got it working... but this is kinda hackish... can i suggest a feature to have an option to wait for everything in the process group to die?
[20:00] <SpamapS> econnell: it really is a corner case. Ideally the *parent* would not die till its children do
[20:00] <SpamapS> econnell: sounds mostly like a bug in traffic_cop's signal handler
[20:00] <econnell> yeah.. i'm pestering the traffic server guys about it now too :)