Skip to content

Add fix to peer discovery logic.#26

Closed
LINCKODE wants to merge 2 commits intomainfrom
peer-discovery-issue
Closed

Add fix to peer discovery logic.#26
LINCKODE wants to merge 2 commits intomainfrom
peer-discovery-issue

Conversation

@LINCKODE
Copy link
Member

@LINCKODE LINCKODE commented Mar 3, 2026

The FindNewPeers method had a deadlock: the channel was only read after waitGroup.Wait(), but goroutines blocked on sending to the full channel prevented Wait from ever returning. When the recursive peer discovery found more than 50 nodes, the 51st send blocked, leaked the goroutine, and silently prevented any discovered peers from being added. The fix moves waitGroup.Wait() and close() into a separate goroutine so the channel is drained concurrently with discovery, preventing the buffer from filling up.

@LINCKODE LINCKODE requested a review from qubicmio March 3, 2026 19:15
@LINCKODE LINCKODE linked an issue Mar 3, 2026 that may be closed by this pull request
}
waitGroup.Wait()
close(nodesChannel)
go func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this most certainly makes the code continue I don't think it fixes the underlying issue.

@qubicmio
Copy link
Member

qubicmio commented Mar 4, 2026

As agreed on. This is not a fix.

@qubicmio qubicmio closed this Mar 4, 2026
@qubicmio qubicmio deleted the peer-discovery-issue branch March 5, 2026 10: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.

Fix public peer discovery issue

2 participants