{"record":{"id":"d16941ed4f9a05dc","repo":"can1357/oh-my-pi","slug":"failed-to-restart-servername-server-process-di","errorCode":null,"errorMessage":"Failed to restart ${serverName}: server process did not exit after kill","messagePattern":"Failed to restart (.+?): server process did not exit after kill","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/lsp/servers.ts","lineNumber":314,"sourceCode":"\t\tconst params = reloadConfigurationParams(client.config);\n\t\tawait sendNotification(client, \"workspace/didChangeConfiguration\", params, signal);\n\t\treturn `Reloaded ${serverName}`;\n\t} catch {\n\t\tthrowIfAborted(signal);\n\t\t// The reload notification could not be delivered — the connection is\n\t\t// wedged or the process already died. Tear the client down (removing it\n\t\t// from the registry by identity and awaiting confirmed process exit) so\n\t\t// the next request cold-starts a fresh client. A kill that never confirms\n\t\t// exit is not a restart: surface the teardown failure truthfully.\n\t\t//\n\t\t// On a broker-shared link a per-session teardown only detaches this\n\t\t// process while the wedged server keeps serving everyone else — ask the\n\t\t// mux to kill the shared server first (best-effort; it also severs us).\n\t\tif (client.proc.sharedMux) {\n\t\t\tawait sendNotification(client, MUX_RESTART_METHOD, undefined, AbortSignal.timeout(2_000)).catch(() => {});\n\t\t}\n\t\tif (!(await shutdownClientInstance(client))) {\n\t\t\tthrow new Error(`Failed to restart ${serverName}: server process did not exit after kill`);\n\t\t}\n\t\treturn `Restarted ${serverName}`;\n\t}\n}\n","sourceCodeStart":296,"sourceCodeEnd":319,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/lsp/servers.ts#L296-L319","documentation":"reloadServer asks the shared LSP server process to shut down; if the process is still alive after shutdown/kill completes, restarting would leave two conflicting instances, so it throws. This indicates a wedged or unkillable server process.","triggerScenarios":"Calling the LSP tool `reload` action (execute → reloadServer) when shutdownClientInstance() returns false — the server process ignored SIGTERM/kill and did not exit within the wait window; with shared-mux servers a best-effort MUX_RESTART notification is sent first (2s timeout) but the local kill still failed.","commonSituations":"A language server deadlocked in native extension code and ignoring signals; a server stuck in uninterruptible I/O; very slow shutdown exceeding the wait window on a large project.","solutions":["Kill the server process manually (find its PID via ps/`omp lsp status`) and retry the reload.","Increase any shutdown timeout available in the server config, or disable the problematic language server extension.","Restart the whole LSP mux daemon to force-reclaim all shared server processes.","Report/pin the wedged language server version — some servers (e.g. certain gopls/jdtls builds) hang on shutdown."],"exampleFix":"// before\nawait lspTool.execute({ action: \"reload\", server: \"typescript\" });\n// after\ntry {\n  await lspTool.execute({ action: \"reload\", server: \"typescript\" });\n} catch (e) {\n  // kill wedged server out-of-band, then retry once\n  await restartMuxDaemon();\n  await lspTool.execute({ action: \"reload\", server: \"typescript\" });\n}","handlingStrategy":"retry","validationCode":"// before reloading, check the server responds\nawait lspTool.execute({ action: \"status\", server: serverName, timeout: 10 });","typeGuard":null,"tryCatchPattern":"try {\n  await lspTool.execute({ action: \"reload\", server: name });\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"did not exit after kill\")) {\n    forceKillServerProcess(name); // out-of-band kill\n    await lspTool.execute({ action: \"reload\", server: name });\n  } else throw err;\n}","preventionTips":["Restart wedged servers proactively if shutdown timeouts recur.","Keep language server extensions up to date (many shutdown hangs are fixed upstream).","Avoid reloading during heavy indexing operations."],"tags":["lsp","process","shutdown","timeout"],"backgroundTag":"process-did-not-exit","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}