René's URL Explorer Experiment


Title: Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debugged · Issue #1720 · microsoft/vscode-java-debug · GitHub

Open Graph Title: Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debugged · Issue #1720 · microsoft/vscode-java-debug

X Title: Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debugged · Issue #1720 · microsoft/vscode-java-debug

Description: Since #1274 / microsoft/java-debug#579, pressing Stop on a launched Java program (with "console": "internalConsole") sends SIGTERM through vm.process().destroy(), so shutdown hooks now run. However, the debugger detaches immediately afte...

Open Graph Description: Since #1274 / microsoft/java-debug#579, pressing Stop on a launched Java program (with "console": "internalConsole") sends SIGTERM through vm.process().destroy(), so shutdown hooks now run. However...

X Description: Since #1274 / microsoft/java-debug#579, pressing Stop on a launched Java program (with "console": "internalConsole") sends SIGTERM through vm.process().destroy(), so shutdown ho...

Opengraph URL: https://github.com/microsoft/vscode-java-debug/issues/1720

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debugged","articleBody":"Since #1274 / microsoft/java-debug#579, pressing **Stop** on a launched Java program (with `\"console\": \"internalConsole\"`) sends SIGTERM through `vm.process().destroy()`, so shutdown hooks now run. However, the debugger detaches immediately afterwards, so breakpoints in shutdown hooks, `@PreDestroy` methods, Spring `SmartLifecycle.stop()`, etc. are never hit. As a result, the shutdown path of an application cannot be debugged from VS Code.\n\nThis is not a duplicate of #1274, #1585 or #1705. Those issues are about whether the JVM is terminated and whether the hooks run at all. This one is about the debug session staying attached while they run.\n\n##### Environment\n- Operating System: Linux Mint 22.1\n- JDK version: 21.0.7\n- Visual Studio Code version: 1.143.0\n- Java extension version: 1.59.2026102108 (pre-release)\n- Java Debugger extension version: 0.60.0\n\n##### Steps To Reproduce\n1. Create a program:\n   ```java\n   public class App {\n       public static void main(String[] args) throws Exception {\n           Runtime.getRuntime().addShutdownHook(new Thread(() -> {\n               System.out.println(\"hook start\");   // breakpoint here\n               System.out.println(\"hook end\");\n           }));\n           Thread.sleep(Long.MAX_VALUE);\n       }\n   }\n   ```\n2. Launch it with a `launch` configuration with `\"console\": \"internalConsole\"`.\n3. Set a breakpoint on the `hook start` line.\n4. Press **Stop**.\n\n##### Current Result\nThe debug session ends immediately. The hook runs (`hook start` / `hook end` may or may not reach the Debug Console), but the breakpoint is not hit.\n\n##### Expected Result\nThe first **Stop** asks the JVM to exit gracefully and keeps the debugger attached, so breakpoints in shutdown code are hit. The session ends when the JVM exits (VMDeath/VMDisconnect). A second **Stop** forcibly kills the JVM, as it does now. IntelliJ IDEA and Eclipse behave this way.\n\n##### Additional Informations\nCause: [`DisconnectRequestHandler.destroyDebugSession`](https://github.com/microsoft/java-debug/blob/main/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/DisconnectRequestHandler.java) does `terminate()` and then `detach()` in a `finally` block. `Process.destroy()` only sends the signal and does not wait for the process, so the debugger is gone before the hooks start. (Before microsoft/java-debug#626 the order was reversed explicitly.)\n\nDAP already supports this two-step behaviour through the [`terminate` request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Terminate). If the adapter reports `supportsTerminateRequest: true`, VS Code sends `terminate` on the first Stop and `disconnect` on the next one. A possible implementation:\n\n- report `supportsTerminateRequest` in the `initialize` response;\n- handle `terminate` with `vm.process().destroy()` (when a `Process` is available) and do **not** detach; the existing VMDeath/VMDisconnect handling then sends `terminated` and ends the session;\n- keep the current `disconnect` behaviour (forced termination) for the second Stop and for restart.\n\nI have checked this approach locally with a small extension. It uses a `DebugAdapterTracker` to add `supportsTerminateRequest`, sends SIGTERM to the PID from the `processid` event, and lets the JVM exit on its own. With it, breakpoints in shutdown hooks are hit, and the session closes when the JVM exits.\n\nWith `\"console\": \"integratedTerminal\"` the adapter has no `Process` and falls back to `vm.exit(0)`, so the hooks do not run at all. That case may need the PID from the `runInTerminal` response, and could be handled separately.","author":{"url":"https://github.com/danilaslynko","@type":"Person","name":"danilaslynko"},"datePublished":"2026-10-22T11:11:27Z","url":"https://github.com/microsoft/vscode-java-debug/issues/1720"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1ec3c28b-55dd-9102-4fe0-d9bab3e84527
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC1E2:3BDB91:18612CF:223112D:6AF7CC30
html-safe-nonce14e1af22f650090d5614ff4e89cb8d8c931317866d85c47bce9f1ea6a9fc4bf2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUUyOjNCREI5MToxODYxMkNGOjIyMzExMkQ6NkFGN0NDMzAiLCJ2aXNpdG9yX2lkIjoiNzA1Nzg2Mjc3Nzk4MDMwODUyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac26c613a2c746003dbd348f0c0a07d4045cd1b3ef56728e8066a1d34b43c827ea
hovercard-subject-tagissue:5978177183
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/vscode-java-debug/1720/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e1426901d9cf3023d6a4702f3379d553310439b5ebebfb0241dd065172fe1740/microsoft/vscode-java-debug/issues/1720
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e1426901d9cf3023d6a4702f3379d553310439b5ebebfb0241dd065172fe1740/microsoft/vscode-java-debug/issues/1720
og:image:altSince #1274 / microsoft/java-debug#579, pressing Stop on a launched Java program (with "console": "internalConsole") sends SIGTERM through vm.process().destroy(), so shutdown hooks now run. However...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedanilaslynko
hostnamegithub.com
expected-hostnamegithub.com
None0538a59d4a0acd1aee7d41f7f56bd94b5294b4b7cb8ac3a11a32ac8bb4562076
turbo-cache-controlno-preview
go-importgithub.com/microsoft/vscode-java-debug git https://github.com/microsoft/vscode-java-debug.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id102584737
octolytics-dimension-repository_nwomicrosoft/vscode-java-debug
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id102584737
octolytics-dimension-repository_network_root_nwomicrosoft/vscode-java-debug
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8a34a01748011ac03e602fdd18a9597dd6341074
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/vscode-java-debug/issues/1720#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-java-debug%2Fissues%2F1720
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-java-debug%2Fissues%2F1720
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2Fvscode-java-debug
Reloadhttps://github.com/microsoft/vscode-java-debug/issues/1720
Reloadhttps://github.com/microsoft/vscode-java-debug/issues/1720
Reloadhttps://github.com/microsoft/vscode-java-debug/issues/1720
microsofthttps://github.com/microsoft
vscode-java-debughttps://github.com/microsoft/vscode-java-debug
Codehttps://github.com/microsoft/vscode-java-debug
Issues201 (201)https://github.com/microsoft/vscode-java-debug/issues
Pull requests7 (7)https://github.com/microsoft/vscode-java-debug/pulls
Discussionshttps://github.com/microsoft/vscode-java-debug/discussions
Actionshttps://github.com/microsoft/vscode-java-debug/actions
Wikihttps://github.com/microsoft/vscode-java-debug/wiki
Security and qualityhttps://github.com/microsoft/vscode-java-debug/security
Insightshttps://github.com/microsoft/vscode-java-debug/pulse
https://github.com/microsoft/vscode-java-debug
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-java-debug/issues/1720
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-java-debug/issues/1720
microsoft/java-debug#645https://github.com/microsoft/java-debug/pull/645
Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debuggedhttps://github.com/microsoft/vscode-java-debug/issues/1720#top
microsoft/java-debug#645https://github.com/microsoft/java-debug/pull/645
https://github.com/wenytang-ms
ai-triagedhttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22ai-triaged%22
bughttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/danilaslynko
danilaslynkohttps://github.com/danilaslynko
on Oct 22, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#issue-5978177183
#1274https://github.com/microsoft/vscode-java-debug/issues/1274
microsoft/java-debug#579https://github.com/microsoft/java-debug/pull/579
#1274https://github.com/microsoft/vscode-java-debug/issues/1274
#1585https://github.com/microsoft/vscode-java-debug/issues/1585
#1705https://github.com/microsoft/vscode-java-debug/issues/1705
DisconnectRequestHandler.destroyDebugSessionhttps://github.com/microsoft/java-debug/blob/main/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/DisconnectRequestHandler.java
microsoft/java-debug#626https://github.com/microsoft/java-debug/pull/626
terminate requesthttps://microsoft.github.io/debug-adapter-protocol/specification#Requests_Terminate
issuelenshttps://github.com/apps/issuelens
ai-triagedhttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22ai-triaged%22
bughttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22bug%22
on Oct 22, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#event-33943479548
issuelenshttps://github.com/apps/issuelens
wenyt (wenytang-ms)https://github.com/wenytang-ms
on Oct 22, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#event-33943483029
https://github.com/apps/issuelens
issuelenshttps://github.com/apps/issuelens
on Oct 22, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#issuecomment-6339543585
IssueLenshttps://github.com/microsoft/IssueLens
#1274https://github.com/microsoft/vscode-java-debug/issues/1274
#1585https://github.com/microsoft/vscode-java-debug/issues/1585
#1705https://github.com/microsoft/vscode-java-debug/issues/1705
wenyt (wenytang-ms)https://github.com/wenytang-ms
completedhttps://github.com/microsoft/vscode-java-debug/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
java-debug#645https://github.com/microsoft/java-debug/pull/645
on Oct 26, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#event-34229655184
https://github.com/wenytang-ms
wenyt (wenytang-ms)https://github.com/wenytang-ms
on Oct 26, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#issuecomment-6409988649
microsoft/java-debug#645https://github.com/microsoft/java-debug/pull/645
https://github.com/wenytang-ms
wenyt (wenytang-ms)https://github.com/wenytang-ms
on Oct 28, 2026https://github.com/microsoft/vscode-java-debug/issues/1720#issuecomment-6464297566
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/vscode-java-debug/issues/1720
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/vscode-java-debug/issues/1720
wenyt (wenytang-ms)https://github.com/wenytang-ms
ai-triagedhttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22ai-triaged%22
bughttps://github.com/microsoft/vscode-java-debug/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.