Session becomes unattachable after shell->client poll() returns EINTR
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
libshpool/src/daemon/shell.rs と shell_inject.rs にある2つの poll ループを読みます。issue では、541〜547行付近の shell ループがリンクされています。各ループが poll エラーをどのように処理するかを確認し、EINTR を再現するか、このケースをカバーするテストを追加してください。完了条件は、両方のループが EINTR の場合に再試行し、再現手順に記載されたシグナルの後もセッションに接続できることです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Rust
- スター
- 2k
- フォーク
- 70
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
shell-pool/shpool のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
shell-pool/shpool#463 ·
メンテナーはふだん 1 日以内に返信
-
misc LLM reportsオープン
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
shell-pool/shpool#454 ·
メンテナーはふだん 1 日以内に返信
-
vterm
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
shell-pool/shpool#445 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
publish .deb filesオープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
shell-pool/shpool#429 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
shell-pool/shpool#412 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
shell-pool/shpool の issue をすべて見る
似ている issue
-
Ignore entry for RUSTSEC-2026-0002 no longer matches anything (`lru` is no longer in `Cargo.lock`)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
influxdata/influxdb#27767 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
oras-project/rust-oci-client-node#132 ·
メンテナーはふだん 2 日以内に返信
-
Ignore entry for RUSTSEC-2020-0168 no longer matches anything (`mach` is no longer in `Cargo.lock`)対応中かも @zyl71 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Blockstream/lwk#213 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
libracoder/kiri#749 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
manuscript-lang/manuscript#6389 ·
メンテナーはふだん 1 日以内に返信