Commons Exec
  1. Commons Exec
  2. EXEC-41

Patch to enable executing thread to return immediately when process is "killed" by a watchdog

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.0, 1.1
    • Fix Version/s: 1.1
    • Labels:
      None
    • Environment:

      Windows XP

      Description

      This has been discussed on the commons-users mailing list. The patch intends to solve the following problem:
      when a process runs longer than allowed by a configured watchdog's timeout, the watchdog tries to destroy it and then DefaultExecutor tries to clean up by joining with all installed pump stream threads. Problem is, that sometimes the native process doesn't die and thus streams aren't closed and the stream threads do not complete.

      The patch provides setAlwaysWaitForStreamThreads(boolean) method in PumpStreamHandler. By default, alwaysWaitForStreamThreads is set to true to preserve the current behavior. If set to false, and process is killed by watchdog, DefaultExecutor's call into ErrorStreamHandler.stop will NOT join the stream threads and DefaultExecutor will NOT attempt to close the streams, so the executor's thread won't get stuck.

      Additionally, this patch fixes a small but annoying bug in DefaultExecuteHandler.setExitValues(int[])

      1. EXEC-41.patch
        5 kB
        Siegfried Goeschl
      2. commons-exec.patch
        6 kB
        Ernest Mishkin

        Activity

        Hide
        Bhavesh Shah added a comment -

        Where should I put this patch files? Means in which directory?

        Show
        Bhavesh Shah added a comment - Where should I put this patch files? Means in which directory?
        Hide
        Siegfried Goeschl added a comment -

        Reverted changes when trying to fix EXEC-41

        Show
        Siegfried Goeschl added a comment - Reverted changes when trying to fix EXEC-41
        Hide
        Siegfried Goeschl added a comment -

        Testing under Windows showed that the patch does not solve the problem - with the patch applied the code now hangs now in DefaultExecutor.closeStreams() until the process (and its children) are terminated. Created a patch with the modifications and reverted them for the code under version control.

        Show
        Siegfried Goeschl added a comment - Testing under Windows showed that the patch does not solve the problem - with the patch applied the code now hangs now in DefaultExecutor.closeStreams() until the process (and its children) are terminated. Created a patch with the modifications and reverted them for the code under version control.
        Hide
        Siegfried Goeschl added a comment -

        Found a bug in the patch and now it works - having said that, using setAlwaysWaitForStreamThreads(false) is for the desperate because it could leave up to three worker threads behind.

        Show
        Siegfried Goeschl added a comment - Found a bug in the patch and now it works - having said that, using setAlwaysWaitForStreamThreads(false) is for the desperate because it could leave up to three worker threads behind.
        Hide
        Siegfried Goeschl added a comment -

        +) I tested Ernest patch a while ago but it did not solve the problem - since then I was a bit side-tracked
        +) DefaultExecuteHandler.setExitValues(int[]) is already fixed
        +) commons-exec-1.0.1 is actually available on the M2 repo (need to solve another infra problem before announcing the the release)

        Show
        Siegfried Goeschl added a comment - +) I tested Ernest patch a while ago but it did not solve the problem - since then I was a bit side-tracked +) DefaultExecuteHandler.setExitValues(int[]) is already fixed +) commons-exec-1.0.1 is actually available on the M2 repo (need to solve another infra problem before announcing the the release)
        Hide
        Konrad Windszus added a comment -

        Especially the bugfix for DefaultExecuteHandler.setExitValues should be applied soon, since this bug prevents disabling of exit value checking with giving null as parameter.

        Show
        Konrad Windszus added a comment - Especially the bugfix for DefaultExecuteHandler.setExitValues should be applied soon, since this bug prevents disabling of exit value checking with giving null as parameter.

          People

          • Assignee:
            Siegfried Goeschl
            Reporter:
            Ernest Mishkin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development