Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix race in adding connections to connsByPeer #1116

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 <kubuxu@protocol.ai>
@Kubuxu Kubuxu force-pushed the fix/mocknet-conn-race branch from ea4087e to 79cc9a4 Compare June 7, 2021 16:49
Kubuxu pushed 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 <kubuxu@protocol.ai>
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
@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 <kubuxu@protocol.ai>
@Stebalien Stebalien merged commit 779acf9 into master Jun 7, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants