Skip to content

Error indicated when stopping Java-based service (e.g. Jenkins agent.jar) #681

@tadasu

Description

@tadasu

Java-based service does not seem to stop properly if <stopparentprocessfirst>true</stopparentprocessfirst> is configured.

If Recovery action is configured to "Restart the Service", following error is indicated and the service is restarted.
error-dialog

If Recovery action is configured to "Take No Action", following error is indicated and the service is stopped.
error-take-no-action

Attached: Event logs, winsw xml file failed-to-stop.zip

Steps to reproduce

Install, start, and stop the service using configuration below under following environment.

<service>
  <id>jenkinsagent-C__JenkinsAgent</id>
  <name>Jenkins agent (jenkinsagent-C__JenkinsAgent)</name>
  <description>This service runs an agent for Jenkins automation server.</description>
  <executable>C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot\bin\java</executable>
  <arguments>-Xrs -jar "%BASE%\agent.jar" -jnlpUrl http://desktop-v47lm8f:8888/computer/DESKTOP-V47LM8F/slave-agent.jnlp -secret af6b0ed588b80344a73b01d71151bb8869c32bdccf7ee556748e75ffe56a636c -workDir "C:\JenkinsAgent"</arguments>
  <log mode="roll"></log>

  <onfailure action="restart" />
  <stopparentprocessfirst>true</stopparentprocessfirst>

  <extensions>
    <extension enabled="true" 
               className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension"
               id="killOnStartup">
      <pidfile>%BASE%\jenkins_agent.pid</pidfile>
      <stopTimeout>5000</stopTimeout>
      <stopParentFirst>true</stopParentFirst>
    </extension>
  </extensions>
</service>

Environment

  • WinSW version: 2.10.2
  • WinSW package type: .NET 4.6.1
  • Windows version: 10.0.19041 Build 19041
  • Wrapped executable and version: Jenkins agent.jar downloaded from Jenkins 2.235.5
  • JDK: AdoptOpenJDK 11.0.6.10 hotspot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions