Skip to content

Bound Node debug adapter startup - #2319

Open
vogella wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
vogella:fix/debug-adapter-startup
Open

vogella wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
vogella:fix/debug-adapter-startup

Conversation

@vogella

@vogella vogella commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

A Node debug adapter which crashed, never answered or was canceled during launch could leave the launch hanging, running on silently or reporting nothing useful. Launch and attach now share this handling in a new DebugAdapter class: these cases end the launch with an error that includes the adapter's stdout and stderr, and the adapter process is stopped. This also removes the duplicated startup, watchdog and cleanup code from the two delegates, and attach now passes Eclipse's environment to the adapter like launch already does.

Share startup and DAP handshake handling between the Node debug delegates, so
that cancellation, adapter exit and timeouts end the launch with an error
which includes the adapter output.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
throw new CoreException(Status.error("Debug adapter not found.", ex)); //$NON-NLS-1$
}
int port = DebugAdapter.findFreePort();
DebugAdapter adapter = DebugAdapter.start(launch, new String[] { runtimeExecutable.getAbsolutePath(),

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Immediate handshake failures can omit captured adapter diagnostics and let unchecked exceptions escape instead of producing a diagnostic CoreException.

1 open issue
What changed in this PR

Centralizes Node debug adapter lifecycle handling for launch and attach, adding bounded startup handling, failure diagnostics, and process cleanup.

Changes:

  • Introduces a shared DebugAdapter for startup monitoring, handshake timeouts, cancellation, and cleanup.
  • Refactors both delegates to use it, with attach now inheriting Eclipse’s environment and using IPv4 loopback.
  • Adds tests for cancellation, adapter exits, and handshake timeouts.
File Description
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​debug/​node/​VSCodeJSDebugDelegate.java Replaces duplicated launch lifecycle code with the shared adapter.
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​debug/​node/​NodeAttachDebugDelegate.java Adopts shared handling, inherited environment, and IPv4 loopback.
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​debug/​node/​DebugAdapter.java Implements adapter monitoring, diagnostics, timeouts, and cleanup.
org.eclipse.wildwebdeveloper.tests/​src/​org/​eclipse/​wildwebdeveloper/​tests/​TestDebug.java Adds cancellation and adapter failure tests.

Review effort: Balanced

if (ex instanceof OperationCanceledException) {
throw canceled();
}
throw ex;
@merks

merks commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

I'm concerned about large last minute changes that will end up in the release without having even been tested by any user. Is now really a good time for such changes I wonder?

Also this PR has a copilot review while a new PR is being queued up:

#2317

Maybe we could finish one after another.

And we do need to find closure very, very soon.

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.

4 participants