From 356ada4adda9496c05cf0031b5b363a31bd5a008 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 18 Jan 2017 15:40:35 +0000 Subject: [PATCH] Do not use log field names 'level', 'msg' or 'time' By default logrus uses these keys. If we also define one, logrus detects this and then works around by adding 'fields.whatever' as the key name. However, in the process of adding the key to the `Fields` it causes a race condition which can crash the process with concurrent map r/w errors. --- .../matrix-org/go-neb/services/github/github_webhook.go | 2 +- src/github.com/matrix-org/go-neb/services/travisci/travisci.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/go-neb/services/github/github_webhook.go b/src/github.com/matrix-org/go-neb/services/github/github_webhook.go index 6951874..981f490 100644 --- a/src/github.com/matrix-org/go-neb/services/github/github_webhook.go +++ b/src/github.com/matrix-org/go-neb/services/github/github_webhook.go @@ -107,7 +107,7 @@ func (s *WebhookService) OnReceiveWebhook(w http.ResponseWriter, req *http.Reque } if notifyRoom { logger.WithFields(log.Fields{ - "msg": msg, + "message": msg, "room_id": roomID, }).Print("Sending notification to room") if _, e := cli.SendMessageEvent(roomID, "m.room.message", msg); e != nil { diff --git a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go index 62a0565..1c86749 100644 --- a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go +++ b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go @@ -228,7 +228,7 @@ func (s *Service) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli } logger.WithFields(log.Fields{ - "msg": msg, + "message": msg, "room_id": roomID, }).Print("Sending Travis-CI notification to room") if _, e := cli.SendMessageEvent(roomID, "m.room.message", msg); e != nil {