Stop the JSONRPC server cleanly on stdin EOF instead of busy-looping
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 50/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- api, backend, testing-qa
调研方向
Start at crates/pet-jsonrpc/src/server.rs, especially start_server, and trace the transport read loop and shutdown path. Reproduce the stdin-EOF behavior with the bounded subprocess harness described in the issue, then add injectable-reader tests for clean and truncated EOF cases plus read errors. Done means deterministic cleanup and successful exit within one second across platforms without disrupting valid streaming.
由索引模型根据 Issue 内容生成。
描述
Tracking plan: #528
Priority: P1. Evidence: reproduced on Windows at 4e523ba.
Problem
The server treats stdin EOF as an empty header and immediately repeats the read/error loop instead of exiting. In a bounded reproduction, closing stdin after a successful info exchange left PET alive after 251 ms, consuming 234 ms of CPU and writing at least 991,232 bytes to stderr.
Source: start_server.
Reproduction
Start pet server with piped stdin/stdout/stderr. Send a correctly framed info request and wait for its response. Close the parent's stdin pipe while continuing to drain stderr. Observe that PET does not exit and repeatedly logs a missing Content-Length error. Use a bounded harness that terminates only its own child after observing the behavior.
Scope
- Treat EOF at the next-frame boundary as normal termination; distinguish truncated headers/payloads from clean EOF.
- Return from the transport loop rather than using an unconditional diverging loop, and define server shutdown/worker cleanup behavior.
- Keep broken-pipe/read/write failures explicit without retrying indefinitely or polluting protocol stdout.
- Make the transport reader injectable so EOF and partial-read tests do not require a permanently running server.
Acceptance criteria
- Closing stdin after a normal exchange exits the subprocess successfully within 1 second on Windows, Linux, and macOS, without a busy loop or error flood.
- Clean EOF, EOF during a header, EOF during a payload, and actual read errors have deterministic tests and documented outcomes.
- Shutdown during an active request does not leave orphaned work or wait forever; cleanup semantics are tested.
- Existing valid request/notification streaming continues to work.
- Test clients can request normal shutdown/close input and use forced termination only as a bounded failure fallback.
Dependencies
No prerequisite. Land early: correct shutdown enables trustworthy coverage collection from server subprocesses. Keep framing/ID expansion in its separate issue under #528.
- 主要语言
- Rust
- 星标
- 207
- 派生
- 45
- 平均合并
- 3 天 6 小时
- 30 天内合并 PR
- 12
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/python-environment-tools 的其他 Issue
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
-
debt
难度 5/5 一周以上 新手友好度 25/100
microsoft/python-environment-tools#538 · 1 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
-
debt
难度 5/5 一周以上 新手友好度 35/100
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
microsoft/python-environment-tools#533 · 2 条评论 ·
查看 microsoft/python-environment-tools 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
bug core
难度 2/5 1-3 小时 新手友好度 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW 未关闭fuzz
难度 2/5 1-3 小时 新手友好度 82/100
ClickHouse/ClickHouse#122114 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
linebender/vello_svg#90 ·
-
难度 2/5 1-3 小时 新手友好度 74/100