erigon-pulse/p2p
battlmonstr 3ca7fdf7e9
p2p: fix discovery shutdown (#8725) (#8735)
Problem:
Some goroutines are blocked on shutdown:
1. table close <-tab.closed // because table loop pending
1. table loop <-refreshDone // because lookup shutdown blocks doRefresh
1. lookup shutdown <-it.replyCh // because it.queryfunc (findnode -
ensureBond) is blocked, and not returning errClosed (if it returns and
pushes to it.replyCh, then shutdown() will unblock)
1. findnode - ensureBond <-rm.errc // because the related replyMatcher
was added after loop() exited, so there's nothing to push errClosed and
unlock it

If addReplyMatcher channel is buffered, it is possible that
UDPv4.pending() adds a new reply matcher after closeCtx.Done().
Such reply matcher's errc result channel will never be updated, because
the UDPv4.loop() has exited at this point. Subsequent discovery
operations will deadlock.

Solution:
Revert to an unbuffered channel.
2023-11-17 09:13:44 +07:00
..
discover p2p: fix discovery shutdown (#8725) (#8735) 2023-11-17 09:13:44 +07:00
dnsdisc Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
enode Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
enr go1.19 gofmt (#4988) 2022-08-10 19:04:13 +07:00
nat [devnet] separate logging p2p (#7549) 2023-05-19 23:08:45 +01:00
netutil Automation tool to automatically upload caplin's snapshot files to R2 (#8747) 2023-11-16 20:59:43 +01:00
rlpx Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
sentry sys deps up (#8695) 2023-11-11 15:04:18 +03:00
simulations p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
dial_integration_test.go Use go:build lines and remove obsolete +build lines (#4175) 2022-05-17 14:46:53 +07:00
dial_test.go move all packages from "internal" folder - to simplify users live (#5857) 2022-10-25 09:58:25 +07:00
dial.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
message_test.go p2p: move rlpx into separate package (#21464) 2020-10-06 14:12:09 +02:00
message.go p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
metrics.go Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
node_key_config.go go1.19 gofmt (#4988) 2022-08-10 19:04:13 +07:00
peer_error.go p2p: limit ping requests from a single peer (#8113) 2023-09-06 17:56:03 +02:00
peer_test.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
peer.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
protocol.go p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
server_test.go [devnet] separate logging - p2p (#7547) 2023-05-19 18:41:53 +01:00
server.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
transport_test.go moved metrics sub packages types to metrics (#8119) 2023-09-03 08:09:27 +07:00
transport.go Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
util_test.go rename (#1978) 2021-05-20 19:25:53 +01:00
util.go Avoiding leaking the popped item (#6193) 2022-12-04 11:17:02 +07:00