Skip to content

fix(client): clear reachable flag when the latency fault detector observes a failure - #11146

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/latency-fault-reachable-flag-reset
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/latency-fault-reachable-flag-reset

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

LatencyFaultToleranceImpl.detectByOneRound only flipped FaultItem.reachableFlag from false to true. Once a broker had been marked reachable, a failing service detector was ignored, so MQFaultStrategy's reachable filter kept selecting a broker that had gone down until a real send happened to fail against it.

Modifications

Reset the flag symmetrically when the detector reports the broker unreachable, so the next broker-selection round sees the failure.

Verification

Fail-before (new test, run against the unpatched code):

Tests run: 3, Failures: 1, Errors: 0, Skipped: 1 -- LatencyFaultToleranceImplTest#testDetectByOneRoundClearsReachableFlagWhenDetectFails

Pass-after:

Tests run: 3, Failures: 0, Errors: 0, Skipped: 1 -- LatencyFaultToleranceImplTest

…erves a failure

detectByOneRound only flipped FaultItem.reachableFlag from false to true.
Once a broker had been marked reachable, a failing service detector was
ignored, so MQFaultStrategy's reachableFilter kept selecting a broker
that had gone down until a real send happened to fail against it. Reset
the flag symmetrically when the detector reports the broker unreachable.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Fix the latency fault detector to clear the reachableFlag when a broker becomes unreachable. Previously, the flag was only set to true on recovery but never cleared on failure, causing stale reachability state.

LGTM — important fix for client-side load balancing correctness.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants