Repository navigation
feat: support DAP terminate requests - #645
Merged
Merged
Conversation
wenyt (wenytang-ms)
requested review from
Changyong Gong (chagong),
Sheng Chen (jdneo) and
Jinbo Wang (testforstephen)
as code owners
October 26, 2026 03:04
There was a problem hiding this comment.
🟡 Changes recommended
Graceful termination can stall when all threads are suspended, and the JDI test needs failure-safe process cleanup.
2 open issues
What changed in this PR
Adds standard DAP terminate support so launched Java sessions can remain attached while shutdown hooks run, addressing microsoft/vscode-java-debug#1720.
Changes:
- Registers the terminate request and advertises its capability.
- Preserves attach/disconnect behavior and shares no-debug process termination.
- Adds handler unit tests and a JDI shutdown-hook breakpoint test.
| File | Description |
|---|---|
| com.microsoft.java.debug.test/project/5.shutdownhook/src/main/java/ShutdownHookTest.java | Adds the shutdown-hook test fixture. |
| com.microsoft.java.debug.core/src/test/java/com/microsoft/java/debug/core/adapter/handler/TerminateRequestHandlerTest.java | Tests termination behavior and capability reporting. |
| com.microsoft.java.debug.core/src/test/java/com/microsoft/java/debug/core/adapter/handler/TerminateRequestHandlerJdiTest.java | Tests debugger attachment during shutdown. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/protocol/Types.java | Adds the terminate capability field. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/protocol/Requests.java | Defines the terminate command and arguments. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/TerminateRequestHandler.java | Handles termination without detaching. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/InitializeRequestHandler.java | Advertises terminate support. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/DisconnectRequestWithoutDebuggingHandler.java | Delegates process termination to the shared helper. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/DebuggeeProcessHelper.java | Centralizes process and PID-based termination. |
| com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/DebugAdapter.java | Registers the terminate handler. |
Review effort: Balanced
Changyong Gong (chagong)
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
terminaterequest support and advertisesupportsTerminateRequestTesting
./mvnw -pl com.microsoft.java.debug.core -Dtest=TerminateRequestHandlerTest,TerminateRequestHandlerJdiTest test./mvnw -pl com.microsoft.java.debug.core verify(55 tests)Resolves microsoft/vscode-java-debug#1720