les/vflux/server: fix priority cornercase causing fuzzer timeout #22650
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.
This PR fixes a cornercase that caused two nodes kicking each other out of the priority pool in an infinite loop when the connection bias was very low. There was an earlier attempted fix for this case that tried to ensure that
estimatePriority
always returns a smaller priority thanpriority
for the same node at the same moment. This was ensured by subtracting 1 fromestimatePriority
result. However, the negative balanceExpiredValue
can change its exponent and lose some precision when adding the bias and in some rare cases this could create a situation when the future priority estimate still wasn't smaller than the current priority. Now the same condition is enforced directly.A second commit simplifies a
ClientPool
condition whenInactiveAllowance
is zero. With the current design there is no need to handle this case separately and increase the risk of creating faulty cornercases in the future. This change is unrelated to the issue detected by the fuzzer, I just realized it during testing but I think it could be in this PR because it is a simple change.