commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siegfried Goeschl <>
Subject Re: ExecuteWatchdog does not really terminate the "hung" process?
Date Mon, 22 Jun 2009 17:49:24 GMT
Hi Ernest,

+) could you please open a JIRA and attach the patch (see
+) I will have a look at winp

Thanks in advance

Siegfried Goeschl

Mishkin, Ernest wrote:
> Siegfried,
> Thanks for looking into this.
> I found that my "main" thread was stuck trying to join with stream
> handling threads.
> I modified PumpStreamHandler::stop - added boolean interrupt parameter,
> where if interrupt == true I call [out|error|input]Thread.interrupt()
> instead of .join().
> Then I modified DefaultExecutor::executeInternal() to pass true to
> PumpStreamHandler::stop when watchdog != null &&
> watchdog.killedProcess().
> I also had to avoid calling closeStreams() in case of forced
> termination.
> The net effect is that now when timeout occurs, my execute() call is
> interrupted, and java code can continue (with the process's output up to
> the point of interruption captured), leaving the
> supposed-to-die-but-not-yet-dead native process (ping in my case)
> running (until it dies on its own).
> This is pretty much the behavior I need / was looking for.
> I also happened to fix NPE in setExitValues().
> If you have any interest in patches, let me know.
> Additionally, there's an open-source library hosted at [1] which
> provides a JNI wrapper around windows native process management so that
> one can truly kill a process.
> This can be integrated with commons-exec as an optional component,
> perhaps.
> Regards,
> Ernest
> [1]
> -----Original Message-----
> From: Siegfried Goeschl [] 
> Sent: Monday, June 22, 2009 1:19 PM
> To: Commons Users List
> Subject: Re: ExecuteWatchdog does not really terminate the "hung"
> process?
> Hi Ernest,
> this is a lurking developer .... :-)
> +) killing your top-level process has not the semantics you would expect
> (see - so
> under Windows it would never kill your "ping" process
> +) it seems that the new ProcessBuilder does not help either (see
> stroy-not-killing-child-processes-in-winxp)
> +) we have a test case
> "DefaultExecutorTest#testExecuteAsyncWithTooLateUserTermination" which
> kills a process using Watchdog - please note that we carefully avoided
> to create s subprocess here since we rely on built-in shell commands -
> we always try to prove that our code works ... :-)
> +) which leaves the question why your thread waits for the whole 10
> seconds - need to investigate that
> Cheers,
> Siegfried Goeschl
> --------------------------------------------------------
> The information contained in this message is intended only for the recipient, and may
be a confidential attorney-client communication or may otherwise be privileged and confidential
and protected from disclosure. If the reader of this message is not the intended recipient,
or an employee or agent responsible for delivering this message to the intended recipient,
please be aware that any dissemination or copying of this communication is strictly prohibited.
If you have received this communication in error, please immediately notify us by replying
to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves
the right, subject to applicable local law, to monitor and review the content of any electronic
message or information sent to or from McGraw-Hill employee e-mail addresses without informing
the sender or recipient of the message.
> --------------------------------------------------------

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message