Skip to content

Bound Node debug adapter startup - #2319

Merged
akurtakov merged 1 commit into
eclipse-wildwebdeveloper:masterfrom
vogella:fix/debug-adapter-startup
Dec 3, 2026
Merged

akurtakov merged 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. DebugAdapter (extracted in #2336) now handles these cases for both launch and attach: they end the launch with an error that includes the adapter's stdout and stderr, and the adapter process is stopped.

Changes to the attach delegate, which now behaves like launch:

  • it binds the adapter to 127.0.0.1 and connects to it, instead of the adapter's default localhost and a connection to ::1;
  • it waits up to 10 s, instead of about 3 s, for the adapter to start listening, and bounds the handshake to 2 minutes;
  • it passes Eclipse's environment to the adapter;
  • errors are reported through the launch framework instead of a separate error dialog.

New tests in TestDebug cover cancellation, an adapter which exits during startup or the handshake, and a handshake timeout.

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.

Fail the launch with an error which includes the adapter output when the
Node debug adapter exits, does not complete the DAP handshake in time or
the launch is canceled, and stop the adapter process.

Attach now behaves like launch: it uses 127.0.0.1 instead of localhost
and ::1, waits up to 10 seconds for the adapter, bounds the handshake and
passes Eclipse's environment to the adapter.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@akurtakov
akurtakov force-pushed the fix/debug-adapter-startup branch from 7ba4d9d to 6a9aa47 Compare December 3, 2026 06:13
@akurtakov
akurtakov merged commit 92a5701 into eclipse-wildwebdeveloper:master Dec 3, 2026
9 checks passed
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.

5 participants