From f8c54200805a9b9088c90f0b46bfa848d7bae67c Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Sun, 3 Jan 2016 22:45:56 +0100 Subject: [PATCH] Fix race condition in JSONFileLogger.Log Signed-off-by: Ingo Gottwald --- daemon/logger/jsonfilelog/jsonfilelog.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/logger/jsonfilelog/jsonfilelog.go b/daemon/logger/jsonfilelog/jsonfilelog.go index 2e7330476d..86baa316b9 100644 --- a/daemon/logger/jsonfilelog/jsonfilelog.go +++ b/daemon/logger/jsonfilelog/jsonfilelog.go @@ -90,6 +90,8 @@ func (l *JSONFileLogger) Log(msg *logger.Message) error { if err != nil { return err } + l.mu.Lock() + defer l.mu.Unlock() err = (&jsonlog.JSONLogs{ Log: append(msg.Line, '\n'), Stream: msg.Source,