Skip to content

Fix race in adding connections to connsByPeer #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2021

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented Jun 7, 2021

Side A could already be running Identify with side B before B had the
connection in the connsByPeer, this lead to Connectedness returning
NotConnected and Identify failing.

Side A could already be running Identify with side B before B had the
connection in the connsByPeer, this lead to Connectedness returning
NotConnected and Identify failing.

Signed-off-by: Jakub Sztandera <[email protected]>
@Kubuxu Kubuxu force-pushed the fix/mocknet-conn-race branch from ea4087e to 79cc9a4 Compare June 7, 2021 16:49
Kubuxu added a commit to filecoin-project/lotus that referenced this pull request Jun 7, 2021
This does not resolve the CI issue but prepares us for it after libp2p/go-libp2p#1116

Signed-off-by: Jakub Sztandera <[email protected]>
@Kubuxu Kubuxu force-pushed the fix/mocknet-conn-race branch from 7440ed7 to 8c97572 Compare June 7, 2021 16:57
Comment on lines 173 to 174
pn1.Lock()
pn2.Lock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to sort these or we'll deadlock. Same with the other locks we're taking.

Signed-off-by: Jakub Sztandera <[email protected]>
@Stebalien Stebalien merged commit 779acf9 into master Jun 7, 2021
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