Skip to content

Fix concurrent map panic in webSocketServer.Close()#214

Open
EnriqueL8 wants to merge 1 commit intohyperledger:mainfrom
kaleido-io:fix-concurrent-map-close
Open

Fix concurrent map panic in webSocketServer.Close()#214
EnriqueL8 wants to merge 1 commit intohyperledger:mainfrom
kaleido-io:fix-concurrent-map-close

Conversation

@EnriqueL8
Copy link
Copy Markdown
Contributor

@EnriqueL8 EnriqueL8 commented Apr 10, 2026

Close() iterated s.connections without holding the mutex while connection goroutines concurrently called connectionClosed()delete(s.connections, ...), causing a concurrent map iteration and map write fatal panic (flaky in TestBroadcastStartWithoutConnections).

Fix: snapshot the connections slice under the lock before closing them, similar to the pattern already used in Broadcast().

@EnriqueL8 EnriqueL8 requested a review from a team as a code owner April 10, 2026 09:38
Signed-off-by: Enrique Lacal <enrique.lacal@kaleido.io>
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.

1 participant