Skip to content

Comments

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

Merged
sukunrt merged 1 commit intolibp2p:masterfrom
b00f:fix/data-dace-relay
Mar 31, 2025
Merged

fix(relay): fix data-race in relayFinder#3258
sukunrt merged 1 commit intolibp2p:masterfrom
b00f:fix/data-dace-relay

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