Service not sending SIGINT properly to java
See original GitHub issueI have a “Hello world” class (https://gist.github.com/treaz/19c8fb4a90e1cb4b9448) running as a service powered by winsw 1.17.
Stopping the service (from windows) does not work as expected (graceful shutdown). I see the following in the logs:
2015-04-23 18:47:52 - Started 18060
2015-04-23 18:47:56 - Stopping testService
2015-04-23 18:47:56 - ProcessKill 18060
2015-04-23 18:47:57 - Found child process: 6540 Name: conhost.exe
2015-04-23 18:47:57 - Stopping process 6540
2015-04-23 18:47:57 - Send SIGINT 6540
2015-04-23 18:47:57 - SIGINT to 6540 failed - Killing as fallback
2015-04-23 18:47:57 - Stopping process 18060
2015-04-23 18:47:57 - Send SIGINT 18060
2015-04-23 18:47:57 - SIGINT to 18060 failed - Killing as fallback
2015-04-23 18:47:57 - Finished testService
I was expecting this to work in 1.17 (according to this https://github.com/kohsuke/winsw/issues/41)
Issue Analytics
- State:
- Created 8 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Service not sending SIGINT properly to java · Issue #95
The SIGINT to the Java process succeeds now and I can tell from my application logs that an orderly shutdown of the container...
Read more >Kill -SIGINT not working from java but working from terminal
I start a c program from java which collect data from a usb device and write to a file . like Below Runtime...
Read more >signals - Why would Ctrl-C behave differently than kill -2
If the program consists of several processes, pressing Ctrl + C sends SIGINT to all the processes in the process group. You can...
Read more >Process being sent SIGINT when started using Upstart
Whenever a "CTRL-C" character (0x02) was received, the kernel generated the SIGINT and sent it to the program. This issue wasn't happening from ......
Read more >Java SDK ContinueAsNew and concurrent signals
The workflow I'm working on has to continue as new and propagate the workflow state when it gets enough signals. The case I'm...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here. My service wrapper runs a batch file (created by the gradle application plugin). Unfortunately, Windows doesn’t have the equivalent of
exec
in bash, socmd
stays in the process tree of the started service, as well as the actual java process.Using
<stopparentprocessfirst>true</stopparentprocessfirst>
as suggested by @rsargant does seem to work, but not super-cleanly: the wrapper still has lots of errors about missing / already killed processes:I guess this is relying on the java process receiving the SIGINT via propagation from the parent process. Maybe conhost and cmd need special handling? i.e. ignore them, kill other process first (in this case java), then kill conhost and cmd only if necessary.
@oleg-nenashev I have tested the latest build on Windows 10, however I’m seeing the same warnings in the wrapper log and application event log. The workaround suggested
<stopparentprocessfirst>true</stopparentprocessfirst>
makes it so the Java process is stopped first (gracefully), but we’re still failing to SIGINT conhost.exe