Skip to content

Fix Viction always warning when a peer disconnected#537

Open
c98tristan wants to merge 6 commits into
BuildOnViction:pre-releasefrom
c98tristan:fix/unregister-peer-warning
Open

Fix Viction always warning when a peer disconnected#537
c98tristan wants to merge 6 commits into
BuildOnViction:pre-releasefrom
c98tristan:fix/unregister-peer-warning

Conversation

@c98tristan
Copy link
Copy Markdown
Contributor

Problem

When a peer is disconnected, others peer will always log warning:

WARN [06-26|14:44:12] Failed to unregister sync peer           peer=0342e9c79df72766 err="peer is not registered"
WARN [06-26|14:44:12] Peer removal failed                      peer=0342e9c79df72766 err="peer is not registered"

Because of the pairPeer connection. When a peer is connected, another connection called pairPeer will be established. It's help split the data transfer through into one for Transactions, Announcements and one for Blocks, Headers, Bodies.
But when the peer is disconnected, 2 connections will simultaneously unregister the same peer and cause the race condition.

Solution

Introduce a unregisterMutex to synchronize unregister peer to prevent race condition.

Additional

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