(PE-45366) Add pe_run_in_parallel option, serial by default on macOS - #309
Merged
Conversation
Magisus
force-pushed
the
worktree-configurable-parallel-execution
branch
from
July 28, 2026 00:24
fff2d7c to
28f6d95
Compare
Several PE install/upgrade steps act on many hosts by fork()ing a child
process per host, each with its own Net::SSH connection. On macOS, forking a
Ruby process that has already used Net::SSH deadlocks the child, so those
steps hang until beaker's watchdog kills them after 1800s
("RuntimeError: Child process ran longer than timeout of 1800"). The hang
never reproduces on Linux/CI. Because beaker always holds SSH connections
before forking, the only reliable workaround is to run serially, and the 5
parallel sites were hardcoded to :run_in_parallel => true with no supported
way to turn them off.
Add a private pe_run_in_parallel? helper on PEUtils that resolves a single
boolean, precedence highest first:
1. BEAKER_PE_RUN_IN_PARALLEL env var (1/true/yes = parallel,
0/false/no = serial)
2. options[:pe_run_in_parallel]
3. default: false on macOS, true on every other platform
The 5 hardcoded :run_in_parallel => true literals in
lib/beaker-pe/install/pe_utils.rb now call the helper. macOS defaults to
serial so Mac developers no longer hit the deadlock out of the box; Linux/CI
behavior is unchanged. A developer can override the default either way via the
option or env var.
Also document the option, env var, precedence, and macOS rationale in the
README, and stub BEAKER_PE_RUN_IN_PARALLEL and RUBY_PLATFORM in the pe_utils
spec so the suite stays hermetic against a developer's exported value and
against being run on a Mac.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Magisus
force-pushed
the
worktree-configurable-parallel-execution
branch
from
July 29, 2026 23:42
28f6d95 to
94a6e2a
Compare
steveax
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's this PR do?
Adds a
pe_run_in_parallelswitch controlling whether beaker-pe's PE install/upgrade steps fork a child process per host or run serially, and changes the default to serial on macOS.Several install/upgrade steps act on many hosts by
fork()ing a child per host, each with its ownNet::SSHconnection. On macOS, forking a Ruby process that has already usedNet::SSHdeadlocks the child, so those steps hang until beaker's watchdog kills them after 1800s (RuntimeError: Child process ran longer than timeout of 1800). This never reproduces on Linux/CI.A new private helper
pe_run_in_parallel?onPEUtilsresolves a single boolean, precedence highest first:BEAKER_PE_RUN_IN_PARALLELenv var (1/true/yes= parallel,0/false/no= serial)options[:pe_run_in_parallel]optionfalseon macOS,trueon every other platformThe 5 hardcoded
:run_in_parallel => trueliterals inlib/beaker-pe/install/pe_utils.rbnow call the helper. Mac developers get serial execution out of the box, so the deadlock no longer bites; a developer on any platform can override the default either direction via the option or env var.Should any of this be tested outside the normal PR CI cycle?
CI runs on Linux, where the default resolves to
true, so behavior is byte-for-byte unchanged there. The macOS serial path is exercised by unit specs (the platform default, option, and env var all resolve tofalseand reach the call sites); the underlying deadlock itself only reproduces on a Mac and isn't covered by CI.Any background context you want to provide?
RUBY_PLATFORM(the machine running beaker, which is the process that forks), matching/darwin/.BEAKER_PE_RUN_IN_PARALLELand being run on a Mac, by stubbing the env var andRUBY_PLATFORMfor every example. Pre-existing:run_in_parallel => truespecs still pass because they run against the pinned non-macOS platform.## Configurationsection documenting the option, env var, precedence, and the macOS default.enhancementfor the changelog generator (feature → minor version bump).🤖 Generated with Claude Code