Fail fast optimization to is_resolvable.#6772
Merged
Merged
Conversation
holmanb
reviewed
Feb 27, 2026
Member
holmanb
left a comment
There was a problem hiding this comment.
I left one nitpick for the code. Also, we use "conventional commits" for commit message format.
Otherwise this looks good to me.
| """ | ||
| global _DNS_REDIRECT_IP | ||
| parsed_url = parse.urlparse(url) | ||
|
|
Member
There was a problem hiding this comment.
Please don't add unnecessary whitespace changes.
Building on the previous optimization in canonical#2040, add an additional optimization to fail early when the hostname is not resolvable at all.
35ec15e to
1c1813d
Compare
|
@holmanb can you take another look? Thanks. |
holmanb
approved these changes
Mar 11, 2026
blackboxsw
pushed a commit
to blackboxsw/cloud-init
that referenced
this pull request
Apr 13, 2026
…le (canonical#6772) Building on the previous optimization in canonical#2040, add an additional optimization to fail early when the hostname is not resolvable at all.
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.
Description
Building on the previous optimization in #2040, this adds an additional optimization to fail early when the hostname is not resolvable at all.
This change reduces unnecessary DNS queries to invalid hostnames like "does-not-exist.example.com.", "example.invalid.", and "cloud_init_expected_not_found" that were observed in Route 53 logs.
This optimization has been stable in Amazon Linux for nearly a year.
Note: This is a resubmission of #6766 with the original author contributing directly as requested.
Proposed Commit Message
Merge type
Squash merge using "Proposed Commit Message"
Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)