Stop the inbound accept loop from spamming errors on shutdown - #575
Stop the inbound accept loop from spamming errors on shutdown#575Bornoz wants to merge 1 commit into
Conversation
When the node shuts down, the inbound listener is closed and listener.Accept() returns "use of closed network connection". The accept loop logged that as an ERROR, waited 5 seconds, and tried again — forever — so a clean shutdown produced a wall of identical ERROR lines that do not indicate anything wrong. The p2p package already has a constant for this case (ErrListenerClosed). Use it: when Accept fails with a closed listener, log a single debug line and return, ending the loop. Every other Accept error keeps the existing back-off-and-retry behaviour. Closes canopy-network#230
|
Looks like this overlaps with #521, which I opened earlier for the same root cause (#230) — flagging for whoever reviews these, not asking for either to be closed. One technical difference worth noting: #521 also covers the other half of #491/#230: |
On shutdown the inbound listener is closed and
listener.Accept()returnsuse of closed network connection. The accept loop logged that asERROR, waited 5s, and retried forever, so a clean shutdown produced a wall of identical ERROR lines (exactly the output in #230).The package already defines
ErrListenerClosedfor this string. WhenAcceptfails with a closed listener, log a single debug line andreturnto end the loop; every other error keeps the existing back-off-and-retry path.go build ./p2p/andgofmtare clean, andgo vet ./p2p/reports nothing new on the changed file (the two pre-existingset_test.gowarnings are unrelated).Closes #230