libp2p / go-libp2p-kad-dht

A Kademlia DHT implementation on go-libp2p
https://github.com/libp2p/specs/tree/master/kad-dht
MIT License
517 stars 221 forks source link

bug/regression: goroutine leak #849

Closed p-shahi closed 1 year ago

p-shahi commented 1 year ago

@Jorropo reports: Hey we have a goroutine leak somewhere in libp2p, is most likely a deadlock does not happear with kubo v0.20 (libp2p v0.27.3) but do with kubo v0.21-rc1 (libp2p v0.27.5), I was trying to bisect it but it sometime does not appear so it made my bisect wrong. Tested with v0.28.0 and v0.27.6 both still have the issue. Here is the profile and screenshot https://ipfs.io/ipfs/QmZpLiWizT6HmnbSjWrwzcp7oAdSYo9e9fsZGQh3Zdd7wM Getting stuck here: https://github.com/libp2p/go-libp2p/blob/b4c9fed04afd7874c7390162481b67caa783d169/p2p/protocol/identify/id.go#L406 https://github.com/libp2p/go-libp2p/blob/b4c9fed04afd7874c7390162481b67caa783d169/p2p/host/eventbus/basic.go#LL40C8-L40C8 https://github.com/libp2p/go-libp2p/blob/b4c9fed04afd7874c7390162481b67caa783d169/p2p/host/eventbus/basic.go#L397 You can start a new v0.21.0-rc1 Kubo node with accelerated DHT client (to generate a bunch of connection, you can also use the default client but will grow more slowly) and do ipfs diag profile then checkout goroutine.pprof most often has the issue.


Issue being discussed here https://filecoinproject.slack.com/archives/C03FFEVK30F/p1686692108230159

Jorropo commented 1 year ago

Code review with issue described in d373974d31867207c5ce3b471f1d8c0fb5f14e05

guillaumemichel commented 1 year ago

To be reviewed: https://github.com/libp2p/go-libp2p-kbucket/pull/120

guillaumemichel commented 1 year ago

addressed in https://github.com/libp2p/go-libp2p-kad-dht/pull/851