AS is killed if the agent is killed (provided it was started/restarted by the agent)

John Mazzitelli mazz at redhat.com
Tue Feb 12 18:37:42 UTC 2013


Why does Java still have a daemon thread running that forked the AS7 process? Shouldn't that be a fire and forget? I would think the child process would get forked/exec'd and then we forget about it, our thread ends. That seems wrong that we are allowing a daemon thread to remain around. Are we sure it needs to be like that? to me, that would be the thing to try to fix (though, I still thought that if you kill a parent thread, any child threads are killed along with it - this is true regardless of whether the parent process is a Java JVM or not - this is just the way the UNIX operating system works. I could be mistaken.

----- Original Message -----
> > BTW, the reason for Ctrl-C killing all processes is that the signal
> > is sent to all processes in the same group.
> 
> We implement it manually in the
> AgentShutdownHook.interruptAllThreads().
> 
> 
> if there is a way to limit the signal to only getting sent to the
> > agent process (and not its child processes such that the child
> > processes remain alive and running even after the parent process
> > (the agent) dies), then that is something we should look into. I
> > didn't think it was possible to do that, but if so, that would be
> > great.
> 
> The problem here is that on the one hand we need to send SIGINT to
> the agent to clear its resources, on the other hand we don't want to
> send the SIGINT to the angent, because he will relay it to the all
> daemon threads (including the running standalone.sh (run by Java
> runtime)). So it is obviously contradictory. Something like "trap
> 'kill -9 myPid' INT" in the rhq.agent.sh would work, but it wouldn't
> clear the resources.
> 
> The only way, I am aware of, is using the & operator:
> 
> "nohup ./rhq-agent.sh --daemon &"  works well
> "./run-in-background.sh ./standalone.sh" works well
> or "Runtime.exec("standalone.sh &")" works well
> 
> check the att., I did a sequence diagram for it, because it is quite
> complex.
> 
> 
> jk
> 
> 
> 
> ----- Original Message -----
> > From: "John Mazzitelli" <mazz at redhat.com>
> > To: rhq-devel at lists.fedorahosted.org
> > Sent: Tuesday, February 12, 2013 5:45:53 PM
> > Subject: Re: AS is killed if the agent is killed (provided it was
> > 	started/restarted by the agent)
> > 
> > > BTW, the reason for Ctrl-C killing all processes is that the
> > > signal
> > > is sent to all processes in the same group.
> > 
> > if there is a way to limit the signal to only getting sent to the
> > agent process (and not its child processes such that the child
> > processes remain alive and running even after the parent process
> > (the agent) dies), then that is something we should look into. I
> > didn't think it was possible to do that, but if so, that would be
> > great.
> > 
> > But we should not eliminate the ability to control-C the agent
> > itself.
> > _______________________________________________
> > rhq-devel mailing list
> > rhq-devel at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/rhq-devel
> > 
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/rhq-devel
> 


More information about the rhq-devel mailing list