Re: Terminating a process tree

From: marcus (marcus_at_welby.md)
Date: 11/09/04


Date: Mon, 08 Nov 2004 18:44:22 -0800

Hey Wayne,
Since you agree this isn't the correct way to do it and you need a hack,
I can suggest one that has worked for me in FreeBSD (should work in any
linux type environment). Instead of launching the second java program
directly I used a control script (stolen from my apache setup, I think)
that records the PID in a dedicated text file. When I needed to kill it
I invoked the control script, which issued the OS kill command on the
recorded PID. Kills it dead as far as I know.

Wayne Marrison wrote:
> (posted yesterday in comp.lang.java.help, but not sure if that was the right
> place and had no response, so posting in here today, sorry for the
> additional bandwidth to those that subscribe to both groups)
>
> Hi group,
>
> I'm new here, so apologies if I ask this in the wrong way.
>
> I have been programming in java for about 2 months, and am currently trying
> to control an external application that I start using:
>
> Process proc;
> Runtime rt;
>
> proc = rt.exec("java.exe -cp ... etc.. something");
>
> Then I capture the input/output & error streams and thread them off.
>
> The problem I have, is that I need to architect for the eventuality of the
> external process locking up and not responding to requests. I have the
> whole capturing of streams in a timeout, so I can tell when the external
> program has not responded within a reasonable time, however when I issue the
> proc.destroy() method, the java.exe process takes up almost 100% cpu and
> never stops. I have to use operating system tools to perform a manual kill
> of the process.
>
> I can only assume that the proc.destroy() doesnt kill the entire process
> tree, and because the command line starts off java.exe, which runs the
> something.class file, a process is orphaned somewhere.
>
> Any help would be much appreciated.
>
> Thanks
>
> Wayne
>
>



Relevant Pages

  • The Problem with D4B YahooGroup Henry Soe Win1
    ... was whether the international community should intervene. ... In response, ... used tanks to kill people on Tiananmen Square. ... The core of R2P is that sovereign states should retain the primary ...
    (soc.culture.burma)
  • Re: House of M #5 (Possible Spoilers)
    ... >>> Wolverine or the Hulk or Namor or even Captain America to kill somebody ... > basic premise is that the greatest heroes of the Marvel Universe have ... And their first response is to kill the ... it would probably sound similar to what Peter ...
    (rec.arts.comics.marvel.universe)
  • Re: OT: How many of your own family would you let be killed, if the only response you had was dispro
    ... By what mathematics do you calculate a disproportionate response? ... A government is obliged to protect its own people. ... And if you kill ONE of ours, then how many of YOURS can we kill? ... The price to be paid for killing one of our people must ...
    (rec.gambling.poker)
  • Re: Obama On Track w/Iraq (Op-Ed) todays NYT (NBC)
    ... This country killed those people with its expansionist policies. ... weren't in the Middle East there wouldn't have been an attack. ... been as constrained as they have been in their response. ... to kill you and me just because of the country we live in, ...
    (rec.music.artists.springsteen)
  • Re: OT: How many of your own family would you let be killed, if the only response you had was dispro
    ... It is eventually subsumed by the horror of the reality of war, ... By what mathematics do you calculate a disproportionate response? ... And if you kill ONE of ours, then how many of YOURS can we kill? ... The price to be paid for killing one of our people must ...
    (rec.gambling.poker)