status-go/metrics/node
Andrea Maria Piana b4e5bf417b Handle peer event async in metrics
There might be an issue on how we handle metrics, which causes the p2p
server to hang.

updateNodeMetrics calls  a method on the p2p server, which
blocks until the server is available:

e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L301)
e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L746)
If there's back-pressure on the peer event feed
e60f425b45/vendor/github.com/ethereum/go-ethereum/p2p/server.go (L783)

The event channel above might become while updateNodeMetrics
is called, which means is never consumed, the server blocks on publishing on
it, and the two will deadlock (server waits for the channel above to be consumed,
this code waits for the server to respond to peerCount, which is in the same
event loop).

Calling it in a different go-routine will allow this code to keep
processing peer added events, therefore the server will not lock and keep processing requests.
2021-02-02 07:58:17 +01:00
..
metrics.go add README for metrics (#1906) 2020-03-17 22:09:21 +01:00
metrics_test.go Ignore full node flag when in topic mode 2020-03-23 15:10:07 +01:00
subscribe.go Handle peer event async in metrics 2021-02-02 07:58:17 +01:00
subscribe_test.go Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00