You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] broadcast.fail.percent=0 does not stop the broadcast at the first failure #16515
3.3 branch (ae809de), OpenJDK 21, macOS. The threshold check has not changed since broadcast.fail.percent was added in #7174 (2.7.9).
Steps to reproduce this issue
BroadcastClusterInvoker documents broadcast.fail.percent=0 as "throw as soon as an exception occurs":
// The value range of broadcast.fail.threshold must be 0~100.// 100 means that an exception will be thrown last, and 0 means that as long as an exception occurs, it will be// thrown.
Export one service on four Dubbo-protocol ports, with an implementation that always throws, and call it through a broadcast reference:
Number of providers invoked for one call, depending on broadcast.fail.percent:
broadcast.fail.percent=0 -> 4 of 4 providers invoked
broadcast.fail.percent=25 -> 1 of 4
broadcast.fail.percent=75 -> 3 of 4
broadcast.fail.percent=100 -> 4 of 4
So 0 stops later than 25 and behaves like the default of 100. Any percentage that rounds down to a threshold of 0 behaves the same way, for example 10 with four providers.
What you expected to happen
With broadcast.fail.percent=0, the broadcast should throw right after the first failed provider, so only one of the four providers is invoked.
Anything else
The threshold is computed as invokers.size() * broadcastFailPercent / 100, which is 0 here, and the loop stops only when failIndex == failThresholdIndex. failIndex is incremented before that comparison, so it is at least 1 and never equals 0: the loop never stops early.
Comparing with >= fixes the zero case and leaves every non-zero threshold unchanged.
Are you willing to submit a pull request to fix on your own?
Yes I am willing to submit a pull request on my own!
Activity