Stop the JSONRPC server cleanly on stdin EOF instead of busy-looping
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 50/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- rust
- Bereich
- api, backend, testing-qa
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Rust
- Sterne
- 207
- Forks
- 45
- Ø Merge
- 3 T. 6 Std.
- Gemergte PRs (30 T.)
- 12
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/python-environment-tools
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
-
debt
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
microsoft/python-environment-tools#538 · 1 Kommentar ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
-
debt
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
microsoft/python-environment-tools#533 · 2 Kommentare ·
Alle Issues in microsoft/python-environment-tools
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
bug core
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Offenfuzz
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
ClickHouse/ClickHouse#122114 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
linebender/vello_svg#90 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100