Skip to content

fix(harness): 修复 Sidecar 停止时管道 FD 泄漏及 atexit 引用残留 - #1245

Merged
xgtcode merged 1 commit into
volcengine:mainfrom
xgtcode:fix/sidecar-pipe-fd-leak
Dec 3, 2026
Merged

xgtcode merged 1 commit into
volcengine:mainfrom
xgtcode:fix/sidecar-pipe-fd-leak

Conversation

@xgtcode

@xgtcode xgtcode commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

stop() only terminated the child process while leaving its stdout/stderr pipes open and keeping the Popen on the binding; the registered atexit callback held the binding alive, so every Sidecar cycle leaked two pipe file descriptors until the process hit its open-file limit.

  • close stdin/stdout/stderr and clear the process in stop() and the startup-failure _terminate_process() path
  • join the stderr drain thread with a bounded timeout before closing
  • unregister the atexit callback so stopped bindings can be reclaimed
  • add regression tests for stream closure, reference reclamation, FD baseline across cycles, and failure-path cleanup

stop() only terminated the child process while leaving its stdout/stderr
pipes open and keeping the Popen on the binding; the registered atexit
callback held the binding alive, so every Sidecar cycle leaked two pipe
file descriptors until the process hit its open-file limit.

- close stdin/stdout/stderr and clear the process in stop() and the
  startup-failure _terminate_process() path
- join the stderr drain thread with a bounded timeout before closing
- unregister the atexit callback so stopped bindings can be reclaimed
- add regression tests for stream closure, reference reclamation, FD
  baseline across cycles, and failure-path cleanup

Co-authored-by: TRAE CLI <traecli@bytedance.com>
@xgtcode xgtcode changed the title fix(harness): close Sidecar pipes and drop atexit binding on stop fix(harness): 修复 Sidecar 停止时管道 FD 泄漏及 atexit 引用残留 Dec 3, 2026
@xgtcode
xgtcode merged commit faaafa0 into volcengine:main Dec 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants