Skip to content

Restart Server: "Stopping timed out" on first click when server is hung #3601

@ekazakov14

Description

@ekazakov14

Extension Version

0.20260421.1

VS Code Version

1.116.0

Operating system Version

macOS 26.3.1 (arm64)

Steps to reproduce

  1. Open a TypeScript workspace and let the language server become unresponsive (in my case the server got stuck inside a long-running diagnostics refresh under heavy memory pressure — see log excerpt below).
  2. Run TypeScript Native Preview: Restart Server from the command palette.
  3. Observe: error popup Stopping the server timed out. Server does not restart. No new diagnostics, no hover, no completions.
  4. Run the command again.
  5. Observe: server restarts normally, no popup.

Deterministic reproduction without waiting for an organic hang: add time.Sleep(5 * time.Second) at the start of handleShutdown in internal/lsp/server.go, build, and trigger Restart Server.

Issue

When the tsgo language server becomes unresponsive, TypeScript Native Preview: Restart Server fails on the first attempt with an error popup (Stopping the server timed out) and does nothing else. Only a second invocation actually restarts the server.

This is the worst possible UX for this command: it breaks in exactly the scenario it exists for — an unresponsive server.

Image

Log excerpt

2026-04-21 12:00:10.653 [info] Delaying scheduled diagnostics refresh...
2026-04-21 12:00:10.655 [info] Delaying scheduled diagnostics refresh...
2026-04-21 12:00:10.655 [info] Delaying scheduled diagnostics refresh...
2026-04-21 12:00:10.656 [info] Delaying scheduled diagnostics refresh...
2026-04-21 12:00:11.158 [info] Running scheduled diagnostics refresh
2026-04-21 13:20:00.595 [info]  Restarting language server...
2026-04-21 13:20:02.598 [error] Stopping server timed out
2026-04-21 13:21:48.083 [info]  Restarting language server...          ← second click
2026-04-21 13:21:48.093 [info]  Resolved client capabilities: { ... }  ← new server up

The 2-second gap between Restarting language server... and Stopping server timed out is vscode-languageclient's hardcoded 2000 ms shutdown timeout. The 1:48 gap between attempts is just user reaction time — any delay above ~2 s would have worked identically.

Related closed issues

The same problem has been reported and closed without a code-side fix at least three times:

  • #1010 — closed by reporter as "seems to be fixed".
  • #1487 — describes the exact same two-click sequence ("I need to remember to click restart again… 2 restarts with a pause inbetween"). Closed when an unrelated server-side change reduced the frequency of hangs, but the client-side timeout-handling bug itself was never addressed.
  • #2213 — same Stopping server timed out popup. Closed for lack of reproducible steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions