[Feature] 重构插件会话停止回执,避免正常关闭通过销毁失败反复探测
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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,确认没有重复建议。
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 151
- Avg merge
- 3h 48m
- Merged PRs (30d)
- 571
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 1lck/Lithe-IDEA
-
review: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
1lck/Lithe-IDEA#2432 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 1/5 Under an hour Newbie friendliness 82/100
1lck/Lithe-IDEA#2431 ·
Maintainers usually reply within 1 day
-
refactor review: high
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
1lck/Lithe-IDEA#2376 ·
Maintainers usually reply within 1 day
-
area:ui enhancement P2 platform:cross-platform refactor review: high
Difficulty 1/5 Under an hour Newbie friendliness 84/100
1lck/Lithe-IDEA#2365 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 3/5 1-2 days Newbie friendliness 57/100
1lck/Lithe-IDEA#2434 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
rel: fix
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/fews-web-oc#2400 ·
Maintainers usually reply within 1 day
-
Command bar: Tab-to-search on claude.ai falls back to Google site: search instead of opening a prompt on ClaudePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ardia-browser/ardia#4426 ·
Maintainers usually reply within 1 day
-
Bug report: isValidISODateDashOnly accepts text before or after the date-timePossibly taken @bardrop claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
pnp/cli-microsoft365#7713 ·
Maintainers usually reply within 1 day
-
Diagram: Journey Type: Bug / Error
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mermaid-js/mermaid-v13#1293 ·
Maintainers usually reply within 1 day