Skip to content

Keep an attached process alive when the DAP client restarts - #1194

Open
adityawrk wants to merge 1 commit into
ruby:masterfrom
adityawrk:fix/attach-restart-keeps-process
Open

adityawrk wants to merge 1 commit into
ruby:masterfrom
adityawrk:fix/attach-restart-keeps-process

Conversation

@adityawrk

@adityawrk adityawrk commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #1184.

Restart in VS Code sends disconnect with restart: true and terminateDebuggee: true. The adapter advertised supportTerminateDebuggee, so it honored the flag and sent kill!. That ends a process the debugger only attached to.

An attach session now treats that combination as a detach: breakpoints are cleared and the debuggee keeps running, so a new session can attach. A disconnect that is not a restart still terminates when terminateDebuggee is true, including a process this session launched.

The new protocol test sends the Restart payload against an attach session and checks that the debuggee accepts another connection. Without the change, that reconnect fails with ECONNREFUSED because the process is already gone. The existing cases still pass: disconnect without terminateDebuggee leaves the process up, and terminateDebuggee without restart still stops it.

VS Code's Restart sends disconnect with restart and terminateDebuggee
both true. Honoring terminateDebuggee kills a process the debugger
only attached to. An attach session now ignores that flag when restart
is set, so the debuggee stays running and can be attached again. A
disconnect that is not a restart still terminates when asked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restarting an rdbg attach session terminates the debuggee process

1 participant