bregctl dev: a detached supervisor can inherit another start's output pipe, hanging parallel installed-dev tests
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with crates/registry-bregctl/tests/dev_lifecycle.rs and trace Session::start() and run_supervisor() to see how the detached process handles inherited file descriptors. Review the macOS process spawning path and reproduce by running the installed-dev tests in parallel. Done when concurrent starts return within a bound and the regression test passes.
索引モデルが issue の本文から書いたものです。
説明
What happens
Running the installed-dev tests in crates/registry-bregctl/tests/dev_lifecycle.rs in parallel can hang one test indefinitely on macOS. The hung test is waiting in Command::output() for EOF on its child's stdout pipe. lsof during a hang showed the write end of that pipe held open by a different test's detached bregctl dev supervisor and the breg server it started, so the read never ends.
Likely cause (medium-high confidence)
On macOS, Rust's standard library creates pipes with pipe() and sets FD_CLOEXEC afterwards, which is not atomic. When two threads call Session::start() at once, one bregctl dev start child can inherit the other thread's pipe write end before FD_CLOEXEC is set. That child then hands the descriptor to its detached supervisor (run_supervisor calls setsid() but keeps inherited descriptors), which keeps it open for the life of the dev environment. The fd numbers matched; the fork itself was not caught.
The same inheritance would affect an operator who starts two dev environments from one parent process, though that is less likely outside tests.
Candidate fixes
- When detaching the supervisor, close every inherited descriptor above 2 (or reopen 0 to 2 on
/dev/nulland close the rest). - Or spawn the supervisor with
posix_spawnandPOSIX_SPAWN_CLOEXEC_DEFAULT, passing only the descriptors it needs.
A regression test can start two sessions concurrently and assert that each dev start returns within a bound.
Found while verifying the external record projections branch (feat/breg-external-views).
- 主要言語
- Rust
- スター
- 2
- フォーク
- 0
- 平均マージ
- 9時間 48分
- マージ済み PR(30日)
- 151
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
registrystack/registry-stack のほかの issue
-
area:breg enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
registrystack/registry-stack#2765 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
registrystack/registry-stack#2761 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
registrystack/registry-stack#2743 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
registrystack/registry-stack#2706 ·
メンテナーはふだん 1 日以内に返信
-
macOS contributor gates: Messaging config tests fail under the symlinked macOS temporary directoryオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
registrystack/registry-stack#2704 ·
メンテナーはふだん 1 日以内に返信
registrystack/registry-stack の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
AstrBotDevs/AstrBot-desktop#197 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
stackabletech/airflow-operator#898 ·
メンテナーはふだん 1 日以内に返信
-
2 advisory ignore entries no longer match anything (`bytes`, `time` already patched in `Cargo.lock`)対応中かも @zyl71 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100