Fix IllegalArgumentException in markExhausted for template-based instance configurations#563
Open
sombraSoft wants to merge 1 commit into
Open
Conversation
…ance configurations Template-based instance configurations leave machineType empty (it is only used when no template is set), but markExhausted's log message called nameFromSelfLink(machineType), which rejects empty input. The exception propagated out of ComputeEngineComputerLauncher.launch() before terminateNode() ran, so the zone was never marked exhausted (defeating the fallback-zone feature) and the dead node was relaunched in a loop by the retention strategy.
das7pad
approved these changes
Jul 9, 2026
das7pad
left a comment
There was a problem hiding this comment.
LGTM, thanks!
(We also see this in our logs at work.)
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.
When a GCE capacity error (
ZONE_RESOURCE_POOL_EXHAUSTED) hits an instance-template-based configuration,markExhausted()throws while formatting its log message:Template-based configurations leave
machineTypeempty (it is only read when no template is set), andnameFromSelfLink("")rejects empty input. Consequences (hit in production during a real us-central1-a stockout):launch()beforeterminateNode()runs, so the dead node is relaunched in a loop by the retention strategy and Jenkins shows "Unexpected error in launching an agent. This is probably a bug in Jenkins" on every cycle;The fix guards the log message: use
machineTypewhen set, fall back to the template name for template-based configurations.Resolves #561
Testing done
InstanceConfigurationTest#testMarkExhaustedDoesNotThrowForTemplateBasedConfigurationbuilds a configuration with an empty machine type and a template, callsmarkExhausted, and asserts the zone is marked. It fails before the fix (IllegalArgumentException) and passes after.InstanceConfigurationTestclass passes (28/28).machineTypepopulated as a workaround,markExhaustedsucceeds and the fallback-zone logic provisioned correctly in another zone during a subsequent real stockout.Submitter checklist