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

オープン
#412 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

shell-pool/shpool のほかの issue

shell-pool/shpool の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。