From 27f08059c5ebf66c56e4c871a33e2d2cd632d4e6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 4 Feb 2019 15:20:35 +1100 Subject: [PATCH 1/2] Fix logging race --- p2p/net/swarm/limiter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/p2p/net/swarm/limiter.go b/p2p/net/swarm/limiter.go index 2def638c3d..ce9e2448ca 100644 --- a/p2p/net/swarm/limiter.go +++ b/p2p/net/swarm/limiter.go @@ -203,8 +203,10 @@ func (dl *dialLimiter) clearAllPeerDials(p peer.ID) { // channel when finished. Once the response is sent it also releases all tokens // it held during the dial. func (dl *dialLimiter) executeDial(j *dialJob) { + dl.lk.Lock() log.Debugf("[limiter] executing dial (dialfunc); peer: %s; addr: %s; FD consuming: %d; waiting: %d", j.peer, j.addr, dl.fdConsuming, len(dl.waitingOnFd)) + dl.lk.Unlock() defer dl.finishedDial(j) if j.cancelled() { return From 9d153e8ea7414170b086b49c972abf0f92da153e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 4 Feb 2019 17:47:51 +0000 Subject: [PATCH 2/2] remove superfluous log statement. --- p2p/net/swarm/limiter.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/p2p/net/swarm/limiter.go b/p2p/net/swarm/limiter.go index ce9e2448ca..ef78f0eeb8 100644 --- a/p2p/net/swarm/limiter.go +++ b/p2p/net/swarm/limiter.go @@ -203,10 +203,6 @@ func (dl *dialLimiter) clearAllPeerDials(p peer.ID) { // channel when finished. Once the response is sent it also releases all tokens // it held during the dial. func (dl *dialLimiter) executeDial(j *dialJob) { - dl.lk.Lock() - log.Debugf("[limiter] executing dial (dialfunc); peer: %s; addr: %s; FD consuming: %d; waiting: %d", - j.peer, j.addr, dl.fdConsuming, len(dl.waitingOnFd)) - dl.lk.Unlock() defer dl.finishedDial(j) if j.cancelled() { return