You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Joel McCance (JIRA)" <ji...@apache.org> on 2012/10/22 19:06:11 UTC

[jira] [Created] (EXEC-68) Watchdog kills process immediately if timeout is too large

Joel McCance created EXEC-68:
--------------------------------

             Summary: Watchdog kills process immediately if timeout is too large
                 Key: EXEC-68
                 URL: https://issues.apache.org/jira/browse/EXEC-68
             Project: Commons Exec
          Issue Type: Bug
    Affects Versions: 1.1, 1.1.1
         Environment: Should exist for all platforms, but specifically identified on Windows 7.
            Reporter: Joel McCance
            Priority: Minor


When using the ExecuteWatchdog with a very large timeout (e.g., Long.MAX_VALUE), the Watchdog immediately destroys the process instead of waiting for the duration of the timeout. For example, the following code snippet would continue immediately:

{code}
DefaultExecutor executor = new DefaultExecutor();
ExecuteWatchdog watchdog = new ExecuteWatchdog(Long.MAX_VALUE);
executor.setWatchdog(watchdog);

executor.execute(cmd); // Where `cmd` could be any valid command.
{code}

--
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

[jira] [Resolved] (EXEC-68) Watchdog kills process immediately if timeout is too large

Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EXEC-68?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved EXEC-68.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.1

commit -m "[EXEC-68] Watchdog kills process immediately if timeout is too large." C:/svn/org/apache/commons/trunks-proper/exec/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java C:/svn/org/apache/commons/trunks-proper/exec/src/main/java/org/apache/commons/exec/Watchdog.java C:/svn/org/apache/commons/trunks-proper/exec/src/changes/changes.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/exec/src/changes/changes.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/exec/src/main/java/org/apache/commons/exec/Watchdog.java
    Sending        C:/svn/org/apache/commons/trunks-proper/exec/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
    Transmitting file data ...
    Committed revision 1401016.
                
> Watchdog kills process immediately if timeout is too large
> ----------------------------------------------------------
>
>                 Key: EXEC-68
>                 URL: https://issues.apache.org/jira/browse/EXEC-68
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.1.1
>         Environment: Should exist for all platforms, but specifically identified on Windows 7.
>            Reporter: Joel McCance
>            Priority: Minor
>             Fix For: 1.1.1
>
>         Attachments: EXEC-68.patch
>
>
> When using the ExecuteWatchdog with a very large timeout (e.g., Long.MAX_VALUE), the Watchdog immediately destroys the process instead of waiting for the duration of the timeout. For example, the following code snippet would continue immediately:
> {code}
> DefaultExecutor executor = new DefaultExecutor();
> ExecuteWatchdog watchdog = new ExecuteWatchdog(Long.MAX_VALUE);
> executor.setWatchdog(watchdog);
> executor.execute(cmd); // Where `cmd` could be any valid command.
> {code}

--
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

[jira] [Updated] (EXEC-68) Watchdog kills process immediately if timeout is too large

Posted by "Joel McCance (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EXEC-68?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joel McCance updated EXEC-68:
-----------------------------

    Attachment: EXEC-68.patch

Bug is a result of the current timeout polling loop relying on being able to add the current system time to the timeout without it overflowing. With very large timeout values, the sum of these two items overflows, so the polling loop exits immediately.

Attached patch changes behavior of Watchdog#run() so that it does not have to add the current millis time to the timeout.
                
> Watchdog kills process immediately if timeout is too large
> ----------------------------------------------------------
>
>                 Key: EXEC-68
>                 URL: https://issues.apache.org/jira/browse/EXEC-68
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.1.1
>         Environment: Should exist for all platforms, but specifically identified on Windows 7.
>            Reporter: Joel McCance
>            Priority: Minor
>         Attachments: EXEC-68.patch
>
>
> When using the ExecuteWatchdog with a very large timeout (e.g., Long.MAX_VALUE), the Watchdog immediately destroys the process instead of waiting for the duration of the timeout. For example, the following code snippet would continue immediately:
> {code}
> DefaultExecutor executor = new DefaultExecutor();
> ExecuteWatchdog watchdog = new ExecuteWatchdog(Long.MAX_VALUE);
> executor.setWatchdog(watchdog);
> executor.execute(cmd); // Where `cmd` could be any valid command.
> {code}

--
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

[jira] [Comment Edited] (EXEC-68) Watchdog kills process immediately if timeout is too large

Posted by "Joel McCance (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EXEC-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13481509#comment-13481509 ] 

Joel McCance edited comment on EXEC-68 at 10/22/12 5:17 PM:
------------------------------------------------------------

Bug is a result of the current timeout polling loop relying on being able to add the current system time to the timeout without it overflowing. With very large timeout values, the sum of these two items overflows, so the polling loop exits immediately.

Attached patch changes behavior of Watchdog#run() so that it does not have to add the current millis time to the timeout, as well as a regression test for DefaultExecutorTest to reproduce the bug should it recur.
                
      was (Author: jmccance):
    Bug is a result of the current timeout polling loop relying on being able to add the current system time to the timeout without it overflowing. With very large timeout values, the sum of these two items overflows, so the polling loop exits immediately.

Attached patch changes behavior of Watchdog#run() so that it does not have to add the current millis time to the timeout.
                  
> Watchdog kills process immediately if timeout is too large
> ----------------------------------------------------------
>
>                 Key: EXEC-68
>                 URL: https://issues.apache.org/jira/browse/EXEC-68
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.1.1
>         Environment: Should exist for all platforms, but specifically identified on Windows 7.
>            Reporter: Joel McCance
>            Priority: Minor
>         Attachments: EXEC-68.patch
>
>
> When using the ExecuteWatchdog with a very large timeout (e.g., Long.MAX_VALUE), the Watchdog immediately destroys the process instead of waiting for the duration of the timeout. For example, the following code snippet would continue immediately:
> {code}
> DefaultExecutor executor = new DefaultExecutor();
> ExecuteWatchdog watchdog = new ExecuteWatchdog(Long.MAX_VALUE);
> executor.setWatchdog(watchdog);
> executor.execute(cmd); // Where `cmd` could be any valid command.
> {code}

--
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