From 53db80da89ac736614cfcfc10ea40ac5f91b2646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 21 Oct 2016 13:09:27 +0300 Subject: [PATCH] eth/downloader: fix a data race in a log output --- eth/downloader/downloader.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index e9dd05248..987be2b7a 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -948,11 +948,12 @@ func (d *Downloader) fetchNodeData() error { } d.syncStatsLock.Lock() d.syncStatsStateDone += uint64(delivered) + syncStatsStateDone := d.syncStatsStateDone // Thread safe copy for the log below d.syncStatsLock.Unlock() // Log a message to the user and return if delivered > 0 { - glog.V(logger.Info).Infof("imported %3d state entries in %9v: processed %d, pending at least %d", delivered, common.PrettyDuration(time.Since(start)), d.syncStatsStateDone, pending) + glog.V(logger.Info).Infof("imported %3d state entries in %9v: processed %d, pending at least %d", delivered, common.PrettyDuration(time.Since(start)), syncStatsStateDone, pending) } }) }