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

torrent.KnownSwarm: keep client lock when iterating over connections #893

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

veshij
Copy link
Contributor

@veshij veshij commented Jan 16, 2024

We started seeing some rate of panics after we added periodic (*Torrent).KnownSwarm() call for debugging purposes.
It looks like in a few other places operations with t.conns are processed while t.cl.rLock() is held, replicating the same behavior.

fatal error: concurrent map iteration and map write

goroutine 86949826 [running]:
github.com/anacrolix/torrent.(*Torrent).KnownSwarm(0xc00355a000)
        go/src/github.com/anacrolix/torrent/torrent.go:248 +0x17d
...

@anacrolix
Copy link
Owner

Good catch, thank you!

@anacrolix anacrolix merged commit 192f4e8 into anacrolix:master Jan 17, 2024
10 checks passed
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