Repository navigation
fix(storage): mount EFS by the mount-target IP first, DNS second (#718) - #718
Merged
Merged
Conversation
#704 shipped the obvious order and the hardware smoke showed it was backwards. Twice out of three runs a mount target already `available` IN THE INSTANCE'S OWN SUBNET produced "Failed to resolve server" for the entire 60-second retry budget, while the same mount by IP succeeded first try with identical options. None of the usual reasons to prefer the name survive contact with spawn: - Encryption in transit would need it, because stunnel validates the certificate against the DNS name. But spawn has no code path that mounts with TLS: EFSMountOptions emits a fixed set and ParseCustomOptions accepts no tls or iam key, so a user cannot even ask for it. - fstab surviving a mount-target replacement is close to worthless for an instance that lives minutes to hours — and had a target really been replaced, the live NFS mount would already be broken. - DNS resolves to the mount target in the querying instance's AZ for free, but spawn already resolves the right target from the instance's own subnet at launch. Deterministic beats hopeful. So the name cost a minute of boot in the common failure and bought nothing. It stays as the fallback for when no IP could be resolved at all — chiefly a caller without elasticfilesystem:DescribeMountTargets — and it is still what goes in /etc/fstab, since the IP does not survive a mount-target replacement. This also closes a verification gap instead of tolerating it. With DNS first the IP path ran ONLY when DNS failed, so it was simultaneously load-bearing and never exercised — and because the failure is intermittent, a passing smoke could not prove it either way. The primary path now runs on every launch and the rarely-taken path is the well-understood one. Separately: the rationale above was carried as comments INSIDE the template, so every byte shipped in every instance's 16 KB user-data budget. Rendered EFS block 3177 -> 1566 bytes, a 51% cut, for prose cloud-init never reads. Moved onto GenerateStorageUserData where it costs nothing. Same lesson as the mpi.go template earlier. The ordering gate compares the offsets of the IP and the DNS name in the rendered script, since a call count cannot distinguish "tried the IP" from "tried it first". Verified to fail against #704's ordering, naming both offsets. One test also now counts `mount -t nfs4` invocations instead of matching comment prose — the earlier version broke on a reworded comment, which is exactly the brittleness worth avoiding in a test that guards generated shell.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
scttfrdmn
added a commit
that referenced
this pull request
Oct 5, 2026
Nine entries: two behaviour changes and seven fixes, three of which were live in v0.121.0. Changed: - EFS mounts by the mount-target IP first, DNS second (#718). #704 shipped the obvious order and the hardware smoke disproved it: twice in three runs DNS failed for the full 60s budget with the mount target available in the instance's own subnet, while the IP mounted first try. Verified on hardware this release — the mount source is now 172.31.93.33:/ with no retry lines at all. - The EFS user-data block is 51% smaller (3177 -> 1566 bytes), because the rationale was carried inside the template and shipped in every instance's 16 KB budget. Fixed: - task status / --wait never read the completion record (#715): the task id was appended twice, broken since v0.117.0. Every finished task read as 'running' and --wait polled to TTL and exited 1 on tasks that succeeded in seconds. - #608's stale-record guard had been inert since v0.117.0 for the same reason — the pre-launch clear was deleting keys that do not exist, which S3 reports as success. - spawn orphans and spawn cleanup reported nothing by default (#708): --mine filtered on a tag spawn never writes to shared infrastructure, so it emptied the result rather than narrowing it. 0 reported in an account holding 27. - Placement groups were double-reported and the id-keyed copy silently failed to delete (#713) — a tolerant error check turned a real failure into success. - cleanup offered spawn's own shared IAM identity for deletion (#713), unmasked by the #708 fix: one bug had been hiding the other. - The smoke leaked the infrastructure it exists to catch leaks of, and then its new leak check reported a false pass over four orphans (#713). Hardware-verified: make smoke 8/8 on both legs at db1708c. The two hardware-sensitive paths changed since v0.121.0 are covered — pkg/userdata/ storage.go by the storage leg, and pkg/aws/iam.go's constants-only change by three successful launches exercising the IAM path.
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.
Follows your question: why bother with EFS DNS at all? Having checked, the answer is mostly "we shouldn't" — #704's ordering was backwards.
What the hardware smoke established
Intermittent, but when it fails it fails for the whole budget, with a mount target already
availablein the instance's own subnet and general DNS working. The same mount by IP succeeded first try with identical options.Why the arguments for the name don't hold here
fs-….efs.region.amazonaws.com. But spawn has no code path that mounts with TLS:EFSMountOptions.ToMountStringemits a fixed set (nfsvers,rsize,wsize,hard,timeo,retrans) andParseCustomOptionsrecognises only those keys, so a user cannot passtlsoriameven deliberately.So the name cost a minute of boot in the common failure and bought nothing. It stays as the fallback for when no IP could be resolved — chiefly a caller without
elasticfilesystem:DescribeMountTargets— and it is still what goes in/etc/fstab, because the IP is what doesn't survive a replacement.It also closes the verification gap rather than living with it
This is the part I'd have had to keep apologising for. With DNS first, the IP path ran only when DNS failed — simultaneously load-bearing and never exercised. And because the failure is intermittent, a green smoke could never prove it; I said as much when closing #704.
Inverted, the primary path runs on every launch and every smoke, and the rarely-taken path is the well-understood one. The unprovable thing is now the thing that barely matters.
A 51% cut to the user-data block, incidentally
The rationale above was carried as comments inside the template, so every byte shipped in every instance's 16 KB user-data budget:
For prose cloud-init never reads. Moved onto
GenerateStorageUserData, where it costs nothing. Same lesson as thempi.gotemplate earlier in this session.On the tests
The ordering gate compares the offsets of the IP and the DNS name in the rendered script, because a call count cannot distinguish "tried the IP" from "tried it first". Verified to fail against #704's ordering, naming both offsets.
One test previously asserted
strings.Contains(script, "mount-target IP")— and broke when I reworded a comment. It now countsmount -t nfs4invocations (2 with an IP, 1 without), which is immune to comment wording. Worth mentioning because a test that guards generated shell should key on the shell, not the prose around it.#704's retry is kept intact: the DNS fallback still gets its full six attempts, and a launch with no resolvable IP behaves exactly as it does today.