[Feature] 重构插件会话停止回执,避免正常关闭通过销毁失败反复探测

Aperta
#1,860 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, java, rust
Ambito
backend

Direzione di ricerca

Start with Runner.Stop in desktop/internal/pluginbackend/pluginbackend.go, which calls DestroyPluginBackend in a retry loop after StopPluginBackend, and with destroy in lsp/interface/engine.rs, which requires the Stopped or Failed lifecycle. The change needs a Core-side stop receipt or structured state that Go can wait on with a bounded deadline. Done means the normal shutdown path no longer relies on expected destroy failures, and the cases in the issue (concurrent Serve exit, cancel during stop, early exit, repeated stop, deadline exhaustion) are covered by tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:language enhancement P2 platform:cross-platform refactor review: high
Problem to solve / 要解决的问题

desktop/internal/pluginbackend/pluginbackend.go:Runner.Stop 在 StopPluginBackend 之后直接循环调用 DestroyPluginBackend,销毁失败就 WaitBackendEvents(...,250) 后再试。这里把 Core 拒绝销毁的错误当作生命周期查询,宿主因此重复推测 Core 所有的可销毁状态。

在 preview 基线 36f0dbdb1 加 Java 无头集成改动的 macOS arm64 源码测试中,关闭 JDT 工作区后 Core 日志反复出现:

app.core.request.failed method=lsp.destroyServer error_code=invalid_request
A running language-server session cannot be destroyed.

本轮进程最终能退出,未观察到残留;当前代价是正常关闭产生 WARN 噪声和多余的跨边界调用,不是已证实的进程泄漏。

Proposed solution / 建议方案

把“停止何时完成、何时可销毁”的权威事实留在 Core。由 Core 提供可复用的终态/处置回执,或让既有停止接口返回可供原生宿主等待的结构化状态;Go 只执行有界等待与原生资源释放,不通过预期失败反复探测。

必须覆盖并发 Serve 已消费 exit 事件、停止中取消、进程提前退出、重复停止和截止时间耗尽,不能简单依赖一次性 exit 通知,也不能把真正的销毁失败全部静默忽略。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

Language support / 语言服务

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案
  • 在 Go 层过滤这条错误:会掩盖边界使用错误,而且保留重复查询。
  • 只等一次 exit 事件:该事件可能被并发 Serve 消费,不足以证明能够销毁。
  • 调整重试间隔:只能减少频率,不能消除职责倒置。
Additional context / 补充信息

已核对 pluginbackend.Runner.Stop 的语言服务器、插件后端和构建提供者调用路径;pluginservice.StopLanguageServer 与 workbench.stopPluginSession 都沿用同一原生桥接。Core 的 lsp/interface/engine.rs:destroy 明确要求生命周期为 Stopped 或 Failed。该逻辑早于当前 Java 接入改动,按现有规则单独记录重构,不夹带到 Java 工作流 PR。

实际验证环境:本机 macOS 26.6.2 arm64、Viva 无头工作台、Core 5a8e67d4b73f5e633e67dc09e722c3b22b47b280、JDT LS 1.61、随插件 JDK 21;合成 Maven 工程,隔离用户存储与插件安装。Windows/Linux 未实际复现,跨平台是共享边界的改进目标。证据来自真实 Core 事件,公开片段已移除路径和临时会话标识。

关联背景:#1832。未上传原始日志或用户配置。

Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Lingua principale
TypeScript
Stelle
1.8k
Fork
151
Merge medio
3h 48m
PR unite (30g)
571

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 1lck/Lithe-IDEA

Tutte le issue di 1lck/Lithe-IDEA

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.