Skip to content

<stopparentprocessfirst> Seems like it will work, but then child processes are force killed immediately? #295

@CafeLungo

Description

@CafeLungo

I know that there is the <stopparentprocessfirst>true</stopparentprocessfirst> option, but I appear to run into other issues with this option trying to immediately force kill conhost.exe even after successfully sending SIGINT to the java process.

So it doesn't have a real chance to shutdown, here is the exact output

2018-12-18 14:44:10 - Starting C:\Program Files (x86)\ServiceApplication\jre\bin\java.exe -Xrs -Xmx256m -jar "C:\Program Files (x86)\ServiceApplication\serviceapplication.jar"
2018-12-18 14:44:10 - Started 11804
2018-12-18 14:44:58 - Stopping ServiceApplication
2018-12-18 14:44:58 - ProcessKill 11804
2018-12-18 14:44:58 - Found child process: 8544 Name: conhost.exe
2018-12-18 14:44:58 - Stopping process 11804
2018-12-18 14:44:58 - Send SIGINT 11804
2018-12-18 14:44:58 - SIGINT to11804 successful
2018-12-18 14:44:58 - Stopping process 8544
2018-12-18 14:44:58 - Send SIGINT 8544
2018-12-18 14:44:58 - SIGINT to 8544 failed - Killing as fallback
2018-12-18 14:44:58 - Finished ServiceApplication

And my config:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<service>
  <id>ServiceApplication</id>
  <name>ServiceApplication for our company</name>
  <description>ServiceApplication for our company</description>
  <executable>C:\Program Files (x86)\ServiceApplication\jre\bin\java.exe</executable>
  <arguments>-Xrs -Xmx256m -jar "%BASE%\serviceapplication.jar"</arguments>
  <logmode>rotate</logmode>
  <stoptimeout>30sec</stoptimeout>
  <stopparentprocessfirst>true</stopparentprocessfirst>
</service>

Why does it try to kill conhost.exe? Why does it try to kill it so quickly, the timeout is set to 30sec

I will admit, I'm currently running on winsw-1.19, but I couldn't find any compelling updates that seemed to affect this. I'm willing to update to 2.x, but wanted to open this to document my issues and get comments. I found other related issue, where the author states 2.x likely wont fix my issue: #123 (comment)

Our Java application (a SpringBoot application) has a quite a few steps to run when it stops, but we can't get it to run on the Windows Service stop. I'd rather not resort to a JMX application with a shutdown call if I can avoid it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions