Skip to content
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

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 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 <kubuxu@protocol.ai>
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
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.

p2p/net/mock/mock_peernet.go Show resolved Hide resolved
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
@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.

None yet

3 participants