Repository navigation
Graceful shutdown (#1274) closed but not fixed? #1585
Description
Activity
Hi ThomasH-75, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
-
This behavior is a known limitation/feature request tracked in issue #1274 (“Debug: Provide graceful shutdown on debug stop action”).
- That issue is closed but no implementation has been released yet.
- You can reactivate or comment on that issue to request a re-open and bump its priority.
-
Workaround:
- Launch your app in a terminal (e.g. set "console": "integratedTerminal" in your launch.json).
- Click into the terminal and press Ctrl+C to trigger your JVM shutdown hooks.
Other references with low confidence
- Plugin Gradle Server processes remaining after vscode is closed
- Shows how another extension sends SIGTERM to allow graceful shutdown;
- URL: Plugin Gradle Server processes remaining after vscode is closed vscode-gradle#684 (comment)
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
-
I have tried to debug why graceful shutdown isn't working in my setup. But I don't know how to enable logging or see the console output. And I have no idea of how to run the debugger in the debugger. Or how to unit test this.
I see the solution done in this commit:
microsoft/java-debug@9ac979aAnd I can tell that
vm.process()returns null. So that explains whyvm.process().destroy()isn't being done.Can confirm this is still broken. Bisected the regression precisely on my end:
- v0.58.5 (released ~6 months ago): Stop works correctly, JVM terminates.
- v0.59.0 (released ~3 months ago): Stop no longer terminates the JVM at all.
Environment: Dev Container (Docker), VS Code 1.127.0 / Cursor 3.9.16, JDK 17/21, debug session launched with
-agentlib:jdwp=...,server=n,suspend=y,....Confirms ThomasH-75 finding — traced via
psbefore/after clicking Stop: no signal reaches the JVM process at all (not even a failed attempt), process state never changes. Using "Run" instead of "Debug" works fine, isolating this to the debug-session termination path (vm.process()returning null → falls through to a JDIvm.exit()path that silently fails to terminate the process, at least in a remote/containerized Extension Host)
Issue #1274 is closed but it seems the fix has not been released, or is not working.
Version 0.58.2 of the extension on https://open-vsx.org claims to include the fix but it doesn't seem to work.
Regardless of which version of the extension I try then when running with debugger the stop button does not allow shutdown hooks to run.
But when running without debugging then the stop button allows shutdown hooks to run (this seems to have always been the case).
And when doing ctrl-c in the VScode terminal window then shutdown hooks run, regardless of debugging or not.
This is a problem for us because our application leaves resources behind when killed harshly, and our developers are switching from Eclipse, where they are used to clicking the red square to stop.
/Thomas