mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-03 11:41:17 +00:00
The LookupRandom RPC handler obtains a node iterator from RandomNodes() but never closes it. RandomNodes() returns a lookupIterator backed by a cancelable context derived from the listener's lifetime context (newLookupIterator -> context.WithCancel). The iterator's Close() is what calls the cancel func, so each LookupRandom call that never closes leaks the cancel func (and any in-flight lookup goroutine) until the discv4 listener shuts down. When the listener serves the RPC API (discv4 --rpc) it is long-lived, so repeated LookupRandom calls accumulate the leak. Close the iterator when the handler returns. This matches how the crawler already releases the same RandomNodes() iterators (crawl.go closes every iterator it consumes). |
||
|---|---|---|
| .. | ||
| abidump | ||
| abigen | ||
| blsync | ||
| devp2p | ||
| era | ||
| ethkey | ||
| evm | ||
| fetchpayload | ||
| geth | ||
| keeper | ||
| rlpdump | ||
| utils | ||
| workload | ||