go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

Goroutines persist after application context is cancelled (identify)

Open blockchainluffy opened this issue 6 months ago • 8 comments

We're observing that internal goroutines do not stop when the parent application context is cancelled in an application using libp2p when it is trying to connect explicitly to some bootstrap nodes.

Even after initiating a shutdown and cancelling the application’s context, logs continue to appear from:

net/identify identify/id.go:431 failed to identify ..........

This happens when trying to make connection explictly by calling host.Connect method and before connection gets established, the application context is cancelled.

Version Information
github.com/libp2p/go-buffer-pool v0.1.0
github.com/libp2p/go-cidranger v1.1.0
github.com/libp2p/go-doh-resolver v0.5.0
github.com/libp2p/go-flow-metrics v0.2.0
github.com/libp2p/go-libp2p v0.41.1
github.com/libp2p/go-libp2p-asn-util v0.4.1
github.com/libp2p/go-libp2p-kad-dht v0.33.0
github.com/libp2p/go-libp2p-kbucket v0.7.0
github.com/libp2p/go-libp2p-pubsub v0.13.1
github.com/libp2p/go-libp2p-record v0.3.1
github.com/libp2p/go-libp2p-routing-helpers v0.7.5
github.com/libp2p/go-libp2p-testing v0.12.0
github.com/libp2p/go-libp2p-xor v0.1.0
github.com/libp2p/go-msgio v0.3.0
github.com/libp2p/go-nat v0.2.0
github.com/libp2p/go-netroute v0.2.2
github.com/libp2p/go-reuseport v0.4.0
github.com/libp2p/go-yamux/v4 v4.0.2
github.com/libp2p/go-yamux/v5 v5.0.0
github.com/libp2p/zeroconf/v2 v2.2.0

blockchainluffy avatar May 12 '25 11:05 blockchainluffy