shell-pool / shell-pool/shpool

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

Open
#412 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2k
Forks
67
Avg merge
3d 1h
Merged PRs (30d)
15

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with daemon/shell.rs and its bidi_stream loop, then inspect daemon/server.rs handle_kill and the existing attach cleanup path. Reproduce the issue with the commands shown and compare bounded and non-bounded attach behavior. Done means the child exit or kill path removes the disconnected record and kill returns a usable result instead of failing silently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.