Fixes bug with excessive rate limiting #5853
Merged
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.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Which issues(s) does this PR fix?
Issue located when working on
init-sync
optimizations, and fix was found immediately - so no corresponding issue opened.Other notes for review
We had several issues:
allowedBlocksPerSecond
:prysm/beacon-chain/sync/rpc_beacon_blocks_by_range.go
Line 78 in 34c02ff
This means, that with our current
init-sync
routine, where requests are interleaved, and it is common to request less than a dozen of blocks for each peer, every request (even for, say, 4 blocks) - will be considered a served request for 64 blocks. So, effectively, sometimes we mark as bad peers, peers which are not bad at all. That's our node sends 9 requests for 4 blocks (and it keeps track to make sure it doesn't get over the limit) in 1 sec - it gets banned (we do not allow x10 increase - x9 is enough to get banned).This issue shouldn't manifest itself with update (#5798) where I indeed force single peer to fetch close to allowed max blocks in each request. But with current routine - we are excessively banning peers.