Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.10
    • Fix Version/s: 1.0.11
    • Component/s: Procrun
    • Labels:
      None
    • Environment:

      MS Windows

      Description

      In order to perform recovery actions (e.g. restart service) the Windows Service Controller needs to detect abnormal program terminations (failures). The Service controller detects a failure if either the service process crashes or the process terminates with a non-zero exit code.

      For my Java server application I want to define recovery actions for the following conditions:
      1) VM crash
      2) Error was thrown (e.g. OutOfMemoryError)
      3) System.exit() with non-zero exit code

      When using prunsrv as a wrapper, I observe the following behaviour:
      1) VM crash is detected only when StartMode=jvm, otherwise the Service Controller ignores the failure situation
      2) When an Error is thrown and StartMode=jvm, prunsrv does not terminate but seems to hang. Therefore, the Service Controller is not aware of the failure. For other StartModes, prunsrv terminates, but the Service Controller does not detect the failure.
      3) When System.exit(42) is called, prunsrv terminates but the Service Controller does not detect the non-zero exit code. This applies for all StartModes.

      It seems to me as if prunsrv always terminates with exit code zero. But I expect the following behaviour:
      1) VM crash with StartMode=jvm -> OK as it is now, but with other StartModes, prunsrv should terminate with a non-zero exit code in order to indicate the abnormal termination.
      2) When an Error is thrown, prunsrv should terminate with a non-zero exit code in order to indicate the abnormal termination.
      3) When System.exit() is called, prunsrv should terminate with the exit code passed to System.exit() (transparent behaviour), in order to let the application indicate a failure situation.

      With the current behaviour, it is not possible to let the Windows Service Controller perform recovery actions.

      1. exit_code_patch_on_1_0_10-u.txt
        7 kB
        Peter Ehrbar
      2. exit_code_patch_on_1_0_10.txt
        8 kB
        Peter Ehrbar

        Issue Links

          Activity

          Peter Ehrbar created issue -
          Hide
          Peter Ehrbar added a comment - - edited

          I have attached a patch (to be applied on 1.0.10) that fixes the VM exit code propagation so that it meets my requirements. With this patch, it is possible to terminate a VM with a non-zero exit code, which is then detected and handled by the Windows Service Controller (e.g. automatically restart the service).

          Show
          Peter Ehrbar added a comment - - edited I have attached a patch (to be applied on 1.0.10) that fixes the VM exit code propagation so that it meets my requirements. With this patch, it is possible to terminate a VM with a non-zero exit code, which is then detected and handled by the Windows Service Controller (e.g. automatically restart the service).
          Peter Ehrbar made changes -
          Field Original Value New Value
          Attachment exit_code_patch_on_1_0_10.txt [ 12518638 ]
          Hide
          Mladen Turk added a comment -

          Could you reattach the patch with 'diff -u'

          Show
          Mladen Turk added a comment - Could you reattach the patch with 'diff -u'
          Mladen Turk made changes -
          Assignee Mladen Turk [ mturk@apache.org ]
          Hide
          Peter Ehrbar added a comment -

          patch generated with diff -u

          Show
          Peter Ehrbar added a comment - patch generated with diff -u
          Peter Ehrbar made changes -
          Attachment exit_code_patch_on_1_0_10-u.txt [ 12549303 ]
          Hide
          Mladen Turk added a comment -

          Patch looks fine.
          You have tabs instead spaces but that's fine. I'll convert those to 4 spaces.

          I'll apply it to the trunk and should be part of next release.
          Thanks!

          Show
          Mladen Turk added a comment - Patch looks fine. You have tabs instead spaces but that's fine. I'll convert those to 4 spaces. I'll apply it to the trunk and should be part of next release. Thanks!
          Hide
          Mladen Turk added a comment -

          Patch applied.
          Thanks!

          Show
          Mladen Turk added a comment - Patch applied. Thanks!
          Mladen Turk made changes -
          Fix Version/s 1.0.11 [ 12320061 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Gary Gregory made changes -
          Link This issue is related to DAEMON-267 [ DAEMON-267 ]
          Hide
          Jess Holle added a comment -

          This is a rather serious gap. Is there any possibility of getting 1.0.11 out the door soon to address this?

          Show
          Jess Holle added a comment - This is a rather serious gap. Is there any possibility of getting 1.0.11 out the door soon to address this?
          Hide
          Gary Gregory added a comment -

          +1 to 1.0.11 to pick this up.

          Show
          Gary Gregory added a comment - +1 to 1.0.11 to pick this up.
          Hide
          Mladen Turk added a comment -

          Sure, next week. Monday.

          Show
          Mladen Turk added a comment - Sure, next week. Monday.
          Hide
          Jess Holle added a comment -

          Thank you! Any early binaries for testing would be much appreciated as well. [I don't have a native Windows build environment set up at the moment.]

          Show
          Jess Holle added a comment - Thank you! Any early binaries for testing would be much appreciated as well. [I don't have a native Windows build environment set up at the moment.]

            People

            • Assignee:
              Mladen Turk
              Reporter:
              Peter Ehrbar
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development