Fix retry logic for TSHttpTxnServerAddrSet (issue #12611)#12733
Merged
bryancall merged 2 commits intoapache:masterfrom Dec 10, 2025
Merged
Fix retry logic for TSHttpTxnServerAddrSet (issue #12611)#12733bryancall merged 2 commits intoapache:masterfrom
bryancall merged 2 commits intoapache:masterfrom
Conversation
When a plugin uses TSHttpTxnServerAddrSet() to set a server address and the connection fails, ATS should retry by calling the OS_DNS hook again to allow the plugin to provide an alternative address. However, the retry logic was missing handling for the USE_API case. Changes: - Added retry handling for ResolveInfo::OS_Addr::USE_API in handle_response_from_server() - Clears dns_info.resolved_p to trigger OS_DNS hook re-execution - Resets os_addr_style to TRY_DEFAULT to allow normal flow - Clears server_request to allow it to be rebuilt for new destination - Added api_server_addr_set_retried flag to prevent infinite retry loops - Added test plugin and autest to verify the fix This matches the documented behavior in TSHttpTxnServerAddrSet API docs which states: 'Plugins should be prepared for TS_HTTP_OS_DNS_HOOK and any subsequent hooks to be called multiple times.'
Contributor
Author
|
Why limit to 1 retry: The retry logic intentionally allows only one additional OS_DNS hook call rather than using
The single retry gives the plugin one opportunity to provide an alternative address on connection failure, which matches what issue #12611 requested. This keeps latency bounded while still enabling the documented retry behavior. Since this is working and we have a test, adding an additional configuration option on how many times to retry the DNS would be easy to do. |
The StillRunningAfter check was failing because processes terminate after the test completes. Since we only need to verify the log content, not that processes stay running, remove this check.
masaori335
approved these changes
Dec 9, 2025
Contributor
masaori335
left a comment
There was a problem hiding this comment.
Adding ResolveInfo::OS_Addr::USE_API case seems make sense. Also, retrying only once is reasonable.
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 plugin uses TSHttpTxnServerAddrSet() to set a server address and the connection fails, ATS should retry by calling the OS_DNS hook again to allow the plugin to provide an alternative address. However, the retry logic was missing handling for the USE_API case.
Changes:
Fixes #12611