logrus: Race condition in entry.Data on calling WithFields() method
fatal error: concurrent map iteration and map write
runtime.mapiternext(0xc000bbee98)
/usr/local/go/src/runtime/map.go:858 +0x579 fp=0xc000bbedd8 sp=0xc000bbed50 pc=0x1011289
vendor/github.com/sirupsen/logrus.(*Entry).WithFields(0xc0001065b0, 0xc0009d3f50, 0xc0009d3f50)
vendor/github.com/sirupsen/logrus/entry.go:117 +0xef fp=0xc000bbef08 sp=0xc000bbedd8 pc=0x1479b0f```
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 12
- Comments: 15 (1 by maintainers)
Commits related to this issue
- fix race conditions on entry closes #1046 — committed to lwsanty/logrus by lwsanty 5 years ago
- fix race conditions on entry closes #1046 — committed to lwsanty/logrus by lwsanty 5 years ago
- fix race conditions on entry closes #1046 — committed to onemouth/logrus by lwsanty 5 years ago
- fix race conditions on entry closes #1046 — committed to cgxxv/logrus by lwsanty 5 years ago
I am experiencing something similar on version 1.4.2. by using a log entries hook which calls the WithField method to add a field to the entry before formatting it and sending it to log entries.