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 condition with host in relay #1273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vladopajic
Copy link

Description

peerScoreInspector is called periodically in separate goroutine started by waku-org/go-libp2p-pubsub. this goroutine can happen to execute simultaneously with goroutine running test TestUpAndDown thus causing race condition.

this issue will probably never appear in normal circumstances as waku node will not be started and stopped repeatedly. however it is nice test case to have as it can identify different issues.

Changes

  • added mutex that will guard simultaneous access to w.host in peerScoreInspector and SetHost.
  • changed order of RUnlock() to happen after RLock() in Topics() for the sake of consistency

How to test

it's hard to reproduce this issue as it is data race.

Issue

closes #984

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.

bug: intermittent data race noticed in CI
1 participant