Description
The following test hangs endlessly for me because the ExecuteWatchdog will never get "processStarted = true" because starting an non-existing process will never lead to the started flag.
@Test public void testCommonsExecHang() throws Exception { CommandLine command = new CommandLine("someunexistingcommand"); DefaultExecutor executor = new DefaultExecutor(); ExecuteWatchdog watchdog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); executor.setWatchdog(watchdog); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler() { @Override public void onProcessFailed(ExecuteException e) { System.out.println("Process did not stop gracefully, had exception '" + e.getMessage() + "' while executing process"); super.onProcessFailed(e); } }; executor.execute(command, null, resultHandler); // this hangs!! watchdog.isWatching(); watchdog.destroyProcess(); }
not calling isWatching(), but only destroyProcess() hangs as well!
Options that I see: timeout the loop or handle the case of failure to start the Watchdog in DefaultExecutor.executeInternal() so that the Watchdog does not hang in this case
Attachments
Issue Links
- is broken by
-
EXEC-34 Race condition prevent watchdog working using ExecuteStreamHandler
-
- Resolved
-