-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug: Provide graceful shutdown on debug stop action #1274
Comments
Since the debugger is using JDI VirtualMachine#exit(int) API to stop the target debuggee, the debugger has little control over this behavior. I'm wondering if other IDEs support the capability you declare? |
@testforstephen IntelliJ does. 🤷♂️ We noticed because our Spring Boot project does some clean up stuff, when shutting down. The IntelliJ users have no problem, but VSCode users have. I'm not sure how IntelliJ is doing it. |
@testforstephen Eclipse also shuts down application gracefully |
The debug panel should work like the Node.js debug extension. The first press of STOP uses SIGINT. The second press of stop sends SIGKILL. The 'restart' command in the debug panel should work similarly - or if the SIGINT doesn't kill the process in X seconds (configurable in the launch.json) a SIGKILL is sent. Then when the process dies and new one is created. This is a serious problem because not running shutdown hooks can leave many applications in a corrupted state. Note too, that if you kill the process using the 'delete icon' in the terminal panel it shuts down gracefully - so it seems this should be rather straightforward to fix. |
I believe the offending code is here - which is in the Java debug server. This should first attempt to get the Process object, and if non-null, use process.destroy() else use the vm.exit() |
Yeah, I second this, I couldn't test my graceful shutdown procedure (without some manual hacks) through VS2022 debugging. Edit: |
现在有消息吗? |
When stopping a debugging session, the application will be killed immediately without running
shutdownHook
code. There is the same discussion in the GO Lang project (golang/vscode-go#120).It would be nice to have the chance to decide, how the application will be killed (
SIGKILL
vsSIGTERM
). Both are valid use-cases. Maybe it's even possible to have options on the STOP button of the debug panel. As we have multi-project workspaces, it really depends on the application (even situation) what you need.Environment
Steps To Reproduce
shutdownHook
(Runtime.addShutdownHook)Current Result
The
shutdownHook
will not be executed.Expected Result
The
shutdownHook
will be executed. (At least if the user chooses to)Additional Informations
N/A
The text was updated successfully, but these errors were encountered: