Repository navigation
fix(httpclient): stop failover retrying the same failed upstream when… - #7489
Merged
Merged
Conversation
… it has no explicit port
Aias00
approved these changes
Oct 8, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Reviewed current head a3e4574856e2.
Failover retry exclusion now recognizes the same upstream across implicit and explicit default ports, while still allowing different ports or schemes. No blocking issue found.
Validation: exact-head targeted Maven reactor tests passed on Java 17.
./mvnw -pl shenyu-plugin/shenyu-plugin-httpclient -am test -Dtest=RetryStrategyTest -Dsurefire.failIfNoSpecifiedTests=false -Drat.skip=true -Djacoco.skip=true -DskipRemoteResources=true -Dmaven.javadoc.skip=true
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 #7475
Problem
With
DefaultRetryStrategy,failoverenabled, and retries configured, a failed upstream without an explicit port is never excluded.For the valid upstream configuration
localhost, ShenYu builds a request such ashttp://localhost/test. HTTP uses port 80, but Java'sURI.getPort()returns-1because the port was omitted from the URI.The exclusion check then constructs
getHost() + ":" + getPort()and compares it directly with the configured upstream:These strings do not match, so the failed upstream remains eligible for every retry. HTTPS upstreams with omitted ports have the same problem.
Impact
Failover can repeatedly request the same failed endpoint, consuming retries instead of selecting another upstream or returning the existing
CANNOT_FIND_HEALTHY_UPSTREAM_URL_AFTER_FAILOVERerror.For a single upstream that keeps timing out, this returns 504 instead of the existing 503 exhaustion response.
Changes
buildDomain()and compare scheme, host, and effective port, usingUriUtils.getActualPort().Validation
Checklist
./mvnw clean install -Dmaven.javadoc.skip=true.