shpool attach -b leaves zombie session records that kill can't remove

未关闭
#412 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
rust
领域
backend, cli

调研方向

从 daemon/shell.rs 及其 bidi_stream 循环开始,然后检查 daemon/server.rs handle_kill 和现有的 attach 清理路径。使用显示的命令重现问题,并比较有界和无界 attach 行为。完成的标准是,子进程退出或 kill 路径会移除已断开连接的记录,并且 kill 返回可用的结果,而不是静默失败。

由索引模型根据 Issue 内容生成。

描述

Warn: This report is generated by AI, but I (human) guarantee the report quality.

Summary

shpool attach -b <name> -c '<quick cmd>' leaves a disconnected zombie session record after the command exits. shpool kill <name> then fails (exit 1, no error message) and the record persists forever.

Reproduce (100%)

shpool attach -b ztest -c '/bin/sleep 0.1'
sleep 1
shpool list          # ztest shows disconnected
shpool kill ztest    # exit 1, record remains

Non--b attach with the same cmd cleans up correctly (control group).

Root cause (libshpool 0.11.0)

  • daemon/shell.rs bidi_stream loop breaks on client_to_shell_h.is_finished() — -b detaches immediately, so the loop exits while the child may still be running → child_done=false → record kept. After the child exits, no supervisor thread is monitoring (already stopped), so the record is never cleaned.
  • daemon/server.rs handle_kill: shell.kill() → signal::kill(child_pid, SIGHUP) → child already dead → ESRCH → returns Err before writing the kill reply → client fails on read_reply (hence no "not found" message).

Expected

  • Zombie records should be reaped when the child exits (even with no client attached), or
  • kill should handle dead children gracefully and remove the record.

Workaround

shpool attach -b <name> (respawns shell, re-links record) then shpool kill <name> works.

主要语言
Rust
星标
2k
派生
70
平均合并
2 天 3 小时
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

shell-pool/shpool 的其他 Issue

查看 shell-pool/shpool 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。