commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Stadler (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (EXEC-71) Changes for EXEC-34 (Race condition prevent watchdog working using ExecuteStreamHandler) hang endlessly if the command cannot be found
Date Sun, 09 Dec 2012 20:51:21 GMT

     [ https://issues.apache.org/jira/browse/EXEC-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dominik Stadler updated EXEC-71:
--------------------------------

    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.

{code}
@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();
	}
{code}

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

  was:
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.

{code}
@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();
	}
{code}

    
> Changes for EXEC-34 (Race condition prevent watchdog working using ExecuteStreamHandler)
hang endlessly if the command cannot be found
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: EXEC-71
>                 URL: https://issues.apache.org/jira/browse/EXEC-71
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.1.1
>            Reporter: Dominik Stadler
>
> 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.
> {code}
> @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();
> 	}
> {code}
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message