Repository navigation
fix(mpi): distribute the cluster SSH key over SSM, and make the enrollment probe see mpirun - #687
Merged
Merged
Conversation
…lment probe see mpirun --mpi had never worked end-to-end. Two independent defects, each sufficient on its own, both invisible to unit tests. 1. MPIConfig.BinariesBucket was never set by any caller, so rank 0's pubkey upload rendered "s3:///", failed parameter validation and aborted cloud-init's scripts-user module — taking the rest of MPI setup with it, so mpirun was never installed. Naming the bucket would not have helped: the spored role grants only s3:GetObject there. The field's comment claimed a default no code applied; it is removed. The public key now rides SSM, the path the peers file already used. The private key stays on rank 0 (user-data would expose it via IMDS; SSM would log it in CloudTrail), and the key is installed before the peers file, which is the release signal. 2. On AL2023 openmpi installs to /usr/lib64/openmpi/bin, which is absent from the non-login PATH SSM gives the enrollment probe. So `command -v mpirun` could never succeed. The probe now sources the MPI/EFA profiles first, testing the environment the job actually runs in. Also: the unbounded peers-file wait now times out after 10 minutes and writes a failed completion record, and assembly failures are reported to stderr instead of being collapsed to "AssemblyFailed" with no cause. Three existing tests asserted the broken S3 exchange as expected behaviour, including a region-substitution test that passed only because the test itself set the field no caller ever set. They now assert its absence. Verified on real hardware at 2, 4, 8 and 16 nodes. Fixes #684
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 4, 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.
Fixes #684.
--mpihad never worked end-to-end. Verified on real hardware at 2, 4, 8 and 16 nodes, plus a 2-node EFA run.Two independent defects, each sufficient alone
1. The cluster SSH key could not be distributed.
mpirunreaches the other ranks over ssh as root, so every node needs rank 0's public key. That went through S3 — butMPIConfig.BinariesBucketwas never set by any caller, so the upload rendereds3:///, failed parameter validation, and aborted cloud-init'sscripts-usermodule, taking the rest of MPI setup with it.mpirunwas therefore never installed andcloud-init statusreaderror.Naming the bucket would not have helped: the spored role grants only
s3:GetObjectonspawn-binaries-*, so the upload would have beenAccessDenied. The field's comment claimed a default ("defaults to spawn-binaries-{region}") that no code applied; the field is removed rather than left as a trap.Distribution now rides SSM, the path the peers file already used — no bucket, no IAM grant, no cross-node polling race. The private key stays on rank 0: user-data would expose it to any local user via IMDS, and SSM would record it in CloudTrail. The key is installed before the peers file, because the peers file is the release signal and
mpirunfollows it immediately.2. The enrollment probe could never pass. On AL2023
openmpiinstalls to/usr/lib64/openmpi/bin, which is not on the default PATH — the user-data adds it via/etc/profile.d/mpi.sh. But SSM runs a non-login shell, so profile.d is never sourced. Confirmed on a livec6i.large:So the probe tested a PATH the workload never uses, and no amount of correct installation could satisfy it. It now sources the MPI/EFA profiles first — the same thing the user-data does before invoking
mpirun— and tolerates their absence for a custom AMI.Together these are why 4 of 4 earlier MPI launches died at
phase=enrolled, and why #671 and #683 had to land first: each failure was hiding the next.Hardware verification
c6i.large, us-east-1. Rank output from the 2-node run, which is the whole fix in four lines:The known-hosts line is rank 0 actually SSHing to node 1 — i.e. the key distribution working. At 16 nodes,
authorized_keyshad exactly 2 lines, so the dedupe guard is holding rather than appending per push.EFA, 2 × c5n.9xlarge (spot). This closes the one claim I kept flagging as unverified in #659 —
fi_pingpong -p efauses the libfabric EFA provider exclusively, with no TCP fallback:Every transfer acknowledged at ~17 µs/xfer — SRD latency, not TCP. EFA SRD passes traffic between nodes through the security group spawn creates, which is exactly what #659's TCP-only rule blocked.
Honest caveats
AssemblyFailedin ~100s (not a budget timeout); the identical re-run passed with 32/16. So there is flakiness at that width — most likely SSM — rather than a hard ceiling. I am not claiming 16 is reliable on the strength of one green run, and it is worth its own issue if it recurs.c5n.9xlargeis 36 vCPU, so 2 nodes is 72 and 8 would need 288 against a 256 spot limit. I checked six regions and the quotas are uniform (64 on-demand / 256 spot), so no region gives more headroom. The EFA run above is 2 nodes.Two things found while verifying
terminal/AssemblyFailed at phase=cohort-assemblywith no cause, and on a failed cohort the instances are already drained — so the reason is unrecoverable. The assembler now prints its own error to stderr before returning it. This is what let me distinguish the transient 16-node failure from a systematic one.Three tests asserted the bug
pkg/userdatahad tests requiringaws s3 cp /root/.ssh/id_rsa.pubandspawn-binaries-us-east-1in the script — they encoded the broken design as the expected one. The worst wasTestGenerateMPIUserData_RegionSubstitution, which asserted region-specific buckets across four regions and passed for years, because the test itself setBinariesBucket. No caller ever did. It proved the template could interpolate a bucket; it never proved anything supplied one.They now assert the absence of the S3 path, and specifically that
s3:///— the string that actually aborted cloud-init — cannot be rendered.Also in here
The unbounded peers-file wait now times out after 10 minutes and writes a failed completion record, so a node the control plane never reaches stops instead of idling on a billing instance until TTL (and #682 means the TTL may not fire either).
Gates
gofmt -lempty,go vet ./...,go test -short ./...(0 failures),make check-docs, changelog gate,semgrep scan --config=auto --error .→ 0 findings. A slow new test that sat through the real 3-minute key-wait budget was made injectable instead (180s → 0.42s), because a slow test becomes a skipped test.Leak-checked after every run: instances 0 across four regions, plus the
spawn-mpi-*security groups and placement groups cleaned up by hand — nothing reaps those yet, which is #685.