Skip to content

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

Description

@AClon314

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions