-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): fixes stale chain metadata being sent to listening state (#…
…5039) Description --- - Removes "caching" of peer metadata - Send only one peer chain metadata at a time to the listening state - increase chain metadata event channel to 20 (so that 20 of the last chain metadata received can be read by listening) Motivation and Context --- Fixes #5037 and #5030 (needs to be confirmed since this case is not easy to reproduce) What I've observed is that the peer is banned twice. The first time, for 30 minutes (between 04:07:23.802123900 and 2022-12-09 04:41:26.365429300) then again permanently (bad metadata sig). It's clear in the logs that the pong is received before being banned, the node is banned (chain metadata service clears the peer's metadata) but the message is already in the domain pipeline so another one is received. The chain metadata service now keeps the peer's chain metadata and sends it to the listening state every time because it is not cleared. TL;DR classic race condition. Order of events: - peer is banned for 30 minutes - peer ban expires - we receive a ping from the peer - at almost the same time peer is banned (see logs in [this comment](#5030 (comment))) - chain metadata service clears the peer from peer_chain_metadata - the ping/pong is received (already in the pipeline from before the ban) - the chain metadata is added to the vec, and is never cleared (because the peer is not banned again) - the peer stays in the list despite being banned and NOT connected, so the header sync continues to try to connect to it How Has This Been Tested? --- Manually: rewind-blockchain and sync, enters sync mode timeously Removed some tests that test removed functions Added a new unit test for determine_sync_state
- Loading branch information
Showing
4 changed files
with
90 additions
and
374 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.