Session becomes unattachable after shell->client poll() returns EINTR
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read the two poll loops in libshpool/src/daemon/shell.rs and shell_inject.rs; the issue links the shell loop around lines 541–547. Check how each loop handles poll errors, then reproduce or add coverage for EINTR. Done means both loops retry on EINTR and the session remains attachable after the signal described in the reproduction.
Written by the indexing model from the issue text.
Description
What happens
When several sessions share one daemon, a session can break permanently: every later shpool attach <name> for it exits with status 1, and the daemon logs
ERROR handle_conn{cid=..}:handle_attach: error shuffling bytes: attaching new client stream to shell->client thread
The session stays listed (disconnected/attached) but can never be attached again; only shpool kill recovers it.
Cause
The session's shell->client thread had exited earlier, at the moment another session in the same daemon spawned its shell:
INFO handle_conn{cid=18}:handle_attach:spawn_subshell: about to fork subshell noecho=false
ERROR shell->client{s="main" cid=3}: polling pty master: EINTR
poll(2) returns EINTR whenever a signal is delivered to the polling thread, and that is never restarted, whatever SA_RESTART says. The shell->client loop treats it as fatal:
So any signal the kernel happens to deliver to that thread (for example the SIGCHLD when another session's shell starts or exits) ends the thread and leaves the session unattachable. The sentinel poll in shell_inject.rs has the same pattern.
Suggested fix
Retry on EINTR in both poll loops, e.g. Err(nix::errno::Errno::EINTR) => continue,, or block the relevant signals on these threads.
Reproduction
shpool 0.11.5 (shpool-x86_64-unknown-linux-gnu release binary), Ubuntu 24.04 container:
- Attach to session
aand leave it running a command that prints continuously. - In the same daemon, repeatedly create sessions, run
exitin them, and force-reattacha(we drove ~20 sessions through ttyd). - It is a race, so it does not happen every round; we hit it twice. When
a's shell->client thread logspolling pty master: EINTR, every later attach toafails as above.
We hit it on an x86_64 container under Docker Desktop on Apple silicon (Rosetta), which may deliver signals to that thread more often, but the code path is the same on native Linux.
Workaround
One daemon per session (shpool --socket <per-session path> attach <name>), so no other session's children signal that daemon. With that, the same stress run passed repeatedly.
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 70
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from shell-pool/shpool
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
shell-pool/shpool#463 ·
Maintainers usually reply within 1 day
-
misc LLM reportsOpen
Difficulty 5/5 Over a week Newbie friendliness 5/100
shell-pool/shpool#454 ·
Maintainers usually reply within 1 day
-
vterm
Difficulty 4/5 3-5 days Newbie friendliness 30/100
shell-pool/shpool#445 · 1 comment ·
Maintainers usually reply within 1 day
-
publish .deb filesOpen
Difficulty 4/5 3-5 days Newbie friendliness 55/100
shell-pool/shpool#429 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
shell-pool/shpool#412 · 2 comments ·
Maintainers usually reply within 1 day
All issues in shell-pool/shpool
Similar issues
-
Ignore entry for RUSTSEC-2026-0002 no longer matches anything (`lru` is no longer in `Cargo.lock`)Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
influxdata/influxdb#27767 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
oras-project/rust-oci-client-node#132 ·
Maintainers usually reply within 2 days
-
Ignore entry for RUSTSEC-2020-0168 no longer matches anything (`mach` is no longer in `Cargo.lock`)Possibly taken @zyl71 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Blockstream/lwk#213 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
libracoder/kiri#749 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
manuscript-lang/manuscript#6389 ·
Maintainers usually reply within 1 day