Shut down DAP server gracefully on disconnection#1018
Merged
lionel- merged 3 commits intobugfix/breakpoints-windowsfrom Jan 28, 2026
Merged
Shut down DAP server gracefully on disconnection#1018lionel- merged 3 commits intobugfix/breakpoints-windowsfrom
lionel- merged 3 commits intobugfix/breakpoints-windowsfrom
Conversation
DavisVaughan
approved these changes
Jan 28, 2026
Contributor
DavisVaughan
left a comment
There was a problem hiding this comment.
As usual, I'm a very big fan of less unwrap()s 😄
Comment on lines
+154
to
+159
| let event = match event { | ||
| Ok(event) => event, | ||
| Err(err) => { | ||
| // Channel closed, sender dropped | ||
| log::info!("DAP: Event channel closed: {err:?}"); | ||
| return; |
Contributor
There was a problem hiding this comment.
So is it getting dropped on the sender side when the ext host restarts suddenly?
Contributor
Author
There was a problem hiding this comment.
I don't think we've hit that code path, it's a defensive fix. It would happen if the DAP comm closed before the DAP connection I think.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Branched on #1016.
Follow up to posit-dev/positron#11407 and posit-dev/positron#11497 where we disabled the exthost restart test on Windows (Slack discussion at https://positpbc.slack.com/archives/C06DNFJSHPD/p1769113239000079).
Not sure what this only surfaced on Windows, but the cause was an Ark crash due to sloppy Unwraps on connection events. This PR makes sure connection errors are propagated, logged, and cause the DAP server to shut down gracefully.
It was a bit tricky to debug because the logs were not showing the crash. The only clue that surfaced was a message in the Console:
and these messages in the Supervisor logs:
0xc0000409is the code forSTATUS_STACK_BUFFER_OVERRUN.Attaching Ark with a debugger then restarting the exthost gave enough time to the process to emit log messages before exit, revealing the DAP panic.