Skip to content

[Lifecycle] Formatter placeholder can be re-registered after disposal #138

Closed

Description

Observed

With isFormatter: true, an in-flight runServer() can re-register the formatter placeholder after its context has been disposed if the restart rejects. The catch path registers the placeholder without checking whether the context was disposed; NullFormatter.dispose() only unregisters the current provider.

Reproduction

  1. Start ctx.runServer() with restartServer held pending and wait until it has been entered.
  2. Call ctx.dispose() and verify the existing placeholder is disposed.
  3. Reject the held restart and await runServer().
  4. Observe a second placeholder registration, with its disposable still live after the context was disposed.

Confirmed using the real context and NullFormatter with a deferred restart rejection on Node 24.17.0. A real rejection can occur, for example, if getDebuggerPath() rejects before restartServer enters its creation/start handlers. This can leave a formatter provider registered after deactivation.

Follow-up

Prevent registrations after context disposal without changing the existing contract to wait for all in-flight starts. Discovered while reviewing #137; that issue is intentionally tests-only.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions