Repository navigation
Record the spot price at launch without re-describing the new instance (#1442) - #1451
Merged
Merged
Conversation
#1442) The RunInstances response has no platformDetails, so recordLaunchSpotPrice re-described the instance just launched and hit EC2's post-launch InvalidInstanceID.NotFound, never retried. Take the billing platform from the AMI (the DescribeImages call Launch already makes) and the zone from the response or request, so no re-describe is needed; when one still is, retry NotFound only, three times within the 10s budget. Fixes #1442
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 #1442
Root cause
recordLaunchSpotPricere-describes the instance only when the instance it is handed lacks a pricablePlatformDetailsor a placement zone. Every one of the 99 failures in the owner's~/.spawn/spawn.logisdescribe instance: ... InvalidInstanceID.NotFound, so that branch ran on every spot launch. RunInstances returns the placement but noplatformDetails, so the platform was the missing input. The describe that followed hit EC2's post-launch eventual-consistency window, and nothing retried it.Fix: remove the re-describe from the launch path
Launchalready callsDescribeImageson the AMI for the root device (rootDeviceInfoFromAMI). That call now also returnsPlatformDetails/Platform(launchInfoFromAMI), so this adds no API call. DescribeImages has no consistency lag against the new instance.LaunchConfig.AvailabilityZoneif the response has none.launchedForSpotPricefills those inputs in beforerecordLaunchSpotPrice, so a normal spot launch prices the instance with no describe at all.InvalidInstanceID.NotFoundonly, after 1s, 2s and 4s (7s, inside the existing 10s budget). Any other error stops it at once.CurrentSpotPrice(spawn statuson old instances) is unchanged and does not retry.Gates (each watched failing against a revert that compiles)
TestLaunch_SpotPriceRecordedWithoutDescribingTheNewInstanceruns a realClient.Launchagainst a wire fake shaped like real EC2: DescribeImages hasplatformDetails, RunInstances has placement but noplatformDetails, and DescribeInstances always returns NotFound. It asserts that no DescribeInstances comes before thespawn:spot-price-per-hourCreateTags, and that the tag is written.result.Instances[0]raw. Result: FAIL, "described instance i-new before recording its spot price" x4, and no tag was sent. The actions were[GetCallerIdentity DescribeImages RunInstances DescribeInstances x4].TestRecordLaunchSpotPrice_RetriesPostLaunchNotFoundmakes the first describe return NotFound and expects the price to be recorded after 2 counted describes.nilretry delays. Result: FAIL,describes = 1, want 2, and nothing was tagged.TestRecordLaunchSpotPrice_RetryIsBoundedAndNotFoundOnlychecks that a persistent NotFound gets 1 + len(delays) describes and no tag, and that UnauthorizedOperation gets exactly one describe.Other post-RunInstances describes in the launch path (checked; none share the pattern)
waitForPrimaryInterface(multi-card EFA EIP) already retries NotFound.WaitForRunning,GetInstancePublicIP,GetInstanceTags,GetInstanceState, the spored liveness probe and port ingress all go throughDescribeInstanceWithRetry(spawn launch: InvalidInstanceID.NotFound immediately after RunInstances succeeds (EC2 eventual consistency) #78).tagOriginalInstanceandpropagateSnapshotTagsToVolumesdescribe nothing about the instance.pkg/launcher.Provisionmakes no instance describe afterLaunch.Checks
make check,make lint(0 issues),semgrep scan --config=auto --error ., andmake api-snapshot(no change: every new symbol is unexported).Not live-verified: that RunInstances never returns
platformDetailsis inferred from the 99/99 log evidence plus the code path, not observed on the wire. The fix records the price either way.