Skip to content

fix(mpi): find fi_info on the real EFA layout, and key the ClientToken per launch - #696

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/691-693-mpi-token-efa-path
Oct 4, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/691-693-mpi-token-efa-path

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #693. Fixes #691. Plus the 0 hr formatter note from #691's tail.

Both reports are correct and both were verified in code before fixing. Thank you for running the hardware pass — and for the two confirmations in #691's tail, which are the first independent check on #671/#678/#687 that isn't mine.

#693 — and your diagnosis of my #684 test is the important part

You were right on all of it. aws-efa-installer puts fi_info in /opt/amazon/efa/bin with its PATH line in its own zippy_efa.sh, and the efa.sh spawn writes contains only:

export FI_PROVIDER=efa
export FI_EFA_USE_DEVICE_RDMA=1

No PATH. So sourcing it accomplishes nothing for finding fi_info, and the probe could not succeed whether EFA was installed or not.

This is #684 again, and the reason is that I fixed the mpirun half and assumed the EFA half worked by analogy. My own session had the evidence and I did not read it: when I ran fi_pingpong during the EFA verification, I wrote export PATH=/opt/amazon/efa/bin:$PATH by hand because it wasn't on PATH. I treated that as a quirk of my ad-hoc command rather than as the same bug.

One data point that may interest you: my 2-node c5n.9xlarge (x86_64) --efa cohort did enroll, and a bare fi_info -p efa over SSM returned provider output there. So on that instance fi_info was resolvable while fi_pingpong was not. Your repro is c8g.48xlarge (arm64), where you measured fi_info as not-on-default-PATH. I can't explain the difference from here and I'm not going to guess — the fix removes the dependency either way.

The probe now appends both install directories to PATH directly instead of trusting a profile file:

for p in /etc/profile.d/mpi.sh /etc/profile.d/*efa*.sh; do [ -f "$p" ] && . "$p" || true; done
PATH="$PATH:/usr/lib64/openmpi/bin:/opt/amazon/efa/bin"

Sourcing is kept (so FI_PROVIDER still applies) and the glob now catches zippy_efa.sh. But correctness no longer rests on a third party's filename, because a probe keyed on someone else's script name breaks when they rename it. PATH is appended, not replaced — the probe still needs the system directories.

And your suggested test is what I built. The tests now execute the generated probe under the exact PATH an SSM shell gets (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin, nothing inherited) with a stub binary on PATH, and assert exit 0 — plus the inverse, that a genuinely absent tool still fails, so "always exit 0" can't satisfy it. That is the difference between "the check exists" and "the check can succeed", exactly as you put it.

#691 — confirmed in code

cohort.NewEntityIntent(mp.name, id, "g1", CohortID(jobArrayID), …, "") with the empty token falls back to Token(cluster, entity, generation), which is sha256(name ‖ entity ‖ gen) — so jobArrayID is the CohortID and never reaches the token, exactly as you traced.

Now memberIdempotencyToken(jobArrayID, id), passed explicitly. I also verified your note about retry: relaunchArrayMembers passes rec.ArrayID into reconcileArrayMembers, so a retried member keeps its first attempt's token and stays idempotent against it rather than racing it.

Tests are the three you asked for plus two more: different tokens across launches of the same name, stable within one launch, distinct per index, retry reuses the original, and a gate that the empty-token call cannot come back (confirmed to fail when I restore "").

Case 2 is the one I'd have hated to find in production — a "successful" launch holding terminated instance IDs. I've kept your framing that it's derived from EC2's documented semantics rather than reproduced.

The 0 hr formatter

Mine, from #662, and a fair catch: %.0f hr turned --ttl 30m into 0 hr. A correct dollar figure next to a zero duration is the worst combination, because "0" is the number a reader trusts. Now:

TTL cost:   $0.07 (30m × 2 instances)

Verified against your exact invocation shape. Whole hours still read 4 hr, not 4.0 hr.

Not fixed here

Your "also worth a look": the EFA installer sharing the 5-minute Enrolled budget with cold boot and SSM registration. I agree it's a real risk and I haven't measured it, because the probe never got far enough to time. It wants its own issue with a measurement rather than a speculative bump — if you have the c8g timings from a now-passing run, that would settle the number.

Gates

gofmt -l empty, go vet ./..., go test -short ./..., make check-docs, changelog gate, semgrep → 0 findings. Each fix confirmed to fail when reverted. Also ran make changelog-fix — merging #690 and #692 had left two ### Fixed groups on main.

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_estimate.go 84.61% 2 Missing ⚠️
cmd/launch_jobarray.go 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…n per launch

but aws-efa-installer puts fi_info in /opt/amazon/efa/bin and its PATH
line in its own zippy_efa.sh — while the efa.sh spawn writes sets no
PATH at all. So in SSM's non-login shell the probe reported "efa
provider missing" until the budget expired, installed or not. This is
analogy.

The probe now appends both install directories to PATH directly rather
than trusting a third party's script name, and globs *efa*.sh. The tests
are now executable: they run the probe under SSM's real PATH with a stub
binary and assert exit 0, plus the inverse. The old tests proved the
check existed, not that it could succeed.

job-array NAME. Two launches sharing a name sent the same token per
index — IdempotentParameterMismatch when parameters differ, or EC2
returning the ORIGINAL reservation when they match, which can hand back
already-terminated instance IDs as a successful launch. Now keyed on the
per-launch jobArrayID: stable within a reconcile, distinct across
launches, and `array retry` keeps its original token.

Also: --estimate-only rendered --ttl 30m as "0 hr".

Fixes #693
Fixes #691
The executable probe test trips dangerous-exec-command. Suppressed
narrowly: the script comes from enrollProbeScript, a fixed template with
no caller input, and executing it is the entire point of the test.

Two gotchas recorded in the comment, each of which cost a CI round-trip:
the directive is honoured only on the offending line or the one
immediately above, and the rule ID must be the FULL id, which ends in a
doubled segment. A truncated id is silently ignored.

My local pre-push semgrep missed this because semgrep scans only
git-tracked files and the new test file was still untracked.
@scttfrdmn
scttfrdmn force-pushed the fix/691-693-mpi-token-efa-path branch from 419807a to da68b7a Compare October 4, 2026 23:43
@scttfrdmn
scttfrdmn merged commit 15c1f19 into main Oct 4, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/691-693-mpi-token-efa-path branch October 4, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant