Repository navigation
fix(jobarray): make the failed-cohort drain actually drain, and unbind --subnet-id from AZ fallback - #686
Merged
Conversation
…d --subnet-id from AZ fallback drainJobArray filtered on in.Tags["spawn:job-array-id"], which is always empty: listInstancesInRegion lifts recognised spawn:* tags into named fields and writes only UNrecognised keys into Tags. So the comparison was always true, every instance was skipped, and the drain terminated nothing — ever. #671 fixed the gating; the drain it gated could not work. Confirmed against two live instances (JobArrayID set, Tags[...] empty with 25 other tags present) and reproduced twice on real hardware. The one terminate seen in a failed run comes from cohort's own cancellation path, so the CULPRIT member was the one left billing while the cancelled one was cleaned up — which read like a race, not a dead code path. Also: an explicit --subnet-id is AZ-bound, but the MPI AZ-fallback chain rewrote Placement.AvailabilityZone, so a pinned subnet got a different zone and EC2 refused every member. Unreachable until #667 stopped dropping --subnet-id, so that combination had never worked. The drain now reports what it found and did in every case; it was silent on both success and zero matches, which is what hid this. Verified on real hardware: before, "drain: no instances matched" and a leaked running instance; after, "drained i-0c03... (running)" and both members terminated. Fixes #683
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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 #683. Both bugs were found by running #659/#668 on real hardware, and both are verified the same way.
The drain never drained
listInstancesInRegionlifts every recognisedspawn:*tag into a named field via a switch and writes only unrecognised keys into theTagsmap.spawn:job-array-idhas its owncase. So that lookup is always"", the comparison is always true, every instance is skipped, anddrainJobArrayterminated nothing, ever.Confirmed against two live instances rather than inferred:
25 other tags present; the one the drain needs, absent.
#671's gating fix was right and its claim was wrong. Making the drain unconditional was correct — but I said it "filters by the
spawn:job-array-idtag, so with nothing launched it costs oneDescribeInstances", which presented a non-functional drain as a working one. I've corrected that entry in this PR rather than only adding a new one.Why it hid for so long
Three things, and I fixed all three rather than the line:
TerminateInstancescall per failed run, and it was never the drain's.InstanceInfo.Tagslooks like "all tags" and is actually "only tags we don't understand". There's now a gate failing the build on any read of a recognisedspawn:*key from that map. It found no other offenders, but the shape is the reusable mistake.The matching predicate also refuses an empty cohort id — otherwise a drain called without one matches every instance in the account and terminates it.
--subnet-idcould not be used with--mpi/--countA subnet lives in exactly one AZ, but the AZ-fallback chain rewrote
Placement.AvailabilityZone:An explicit subnet now takes the same single-rung path a fixed
--placement-groupalready took — the precedent was already there, for the same reason.This was unreachable until #667, which stopped dropping
--subnet-id. So the combination had never worked, and my #667 unit tests could see the subnet arrive on the config but not that it then contradicted the AZ chain. That gap is the honest argument for the hardware run.Verification on real hardware
Two
c6i.largeas an MPI cohort, failing atphase=enrolled, before and after:Before
After
Leak-checked afterwards across instances, placement groups, security groups, EFS and volumes: all zero.
Also verified in the same session (not changed here)
IpProtocol: "-1"on both ingress and egress, confirmed bydescribe-security-groupsagainst real EC2. That proves AWS accepts"-1"with no port range on both authorize calls, which the emulator could not tell us./var/log/spawn-command.logopened with✅ prerequisite ready: /run/spawn/storage-ready, withdf -h /efsshowing the mount live, and the gate file readingok(so the/proc/mountsverification ran).sporedinstalled andsystemctl is-active spored→activeon a job-array member, which is the fix working: before it, cloud-init skipped the whole script.Cost estimate for 2 × c6i.large.Filed, not fixed here
--mpihas never worked end-to-end:BinariesBucketis never set by any caller, so the key exchange renderss3:///, cloud-init'sscripts-usermodule dies, andmpirunis never installed. 4 of 4 MPI launches failed this way. This blocks EFA traffic verification (fi_pingpong/osu_latencyneed a workingmpirunon two nodes), so --mpi --efa: auto MPI security group is TCP-only, so EFA cannot pass traffic; and it silently overwrites --security-group-ids #659 remains verified at the SG and provider level only. The fix needs a decision on where the key exchange belongs — I think SSM, since the peers file already rides it.--mpiwithout--job-array-namecreates an SG namedspawn-mpi-before validating its flags.Gates
gofmt -lempty,go vet ./...,go test -short ./...(0 failures),make check-docs, changelog gate,semgrep scan --config=auto --error .→ 0 findings. Both new gates confirmed to fail against the old code.