Skip to content

fix(relay): fix data-race in relayFinder #3258

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 1 commit into from
Mar 31, 2025

Conversation

b00f
Copy link
Contributor

@b00f b00f commented Mar 30, 2025

Description

This PR fixes a data race condition in the relay finder. It was observed here.

The cleanupDisconnectedPeers function deletes rf.relays while, at the same time, getCircuitAddrs iterates over the map.

This PR adds a lock in getCircuitAddrs to ensure it iterates over the map only when it is unlocked.

@sukunrt
Copy link
Member

sukunrt commented Mar 31, 2025

Thanks @b00f

@sukunrt sukunrt merged commit 88b1a70 into libp2p:master Mar 31, 2025
9 checks passed
@b00f b00f deleted the fix/data-dace-relay branch March 31, 2025 17:40
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.

2 participants