-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition in entry.Data on calling WithFields() method #1046
Comments
What version of logrus are you using? |
@oshankkumar could you please check it on PR branch #1047 ? |
I'm experiencing the same issue with logrus v1.4.2. I did not manage to get a full output of the trace (Stackdriver removes formatting and is not very good at exporting ad-hoc logs), but I did manage to get the parts that are touching logrus code:
|
@oshankkumar do you use any hooks which could modify the Data map of the entry ? |
how to fix, if use hooks which could modify the Data map of the entry |
We had success using #1047, stopped the panics for us. |
Seeing the same panic on 1.4.2 with use of Entry. Edit: Actually, I misspoke. I'm seeing a different map range issue here: https://github.com/sirupsen/logrus/blob/v1.4.2/text_formatter.go#L109 |
@oshankkumar (or anyone else) can you please provide some code that reproduces this issue in logrus@v1.4.2? I'm unable to reproduce it, thanks |
I tried to write up a test that fails with the use of Entry + hooks, but I think my lack of a working local environment to receive the hook has slowed me down. Here's a stack trace from 6 days ago in production, slightly cleaned:
|
This issue was happening in my project once a day. In 24 hours, millions of log entries were reported without issue. But when it happened it was always on I worked around the problem by not using WithFields. Then I use a hook to set field values into the entry.Data ... |
I am experiencing something similar on version 1.4.2. |
Is there any reason we can't just put a mutex on the Data map to protect it or add a method to do a copy of the map? This issue also affects hooks which mutate data(ie add an extra field). #953 |
duplicate of #1217 |
should be fixed now |
The text was updated successfully, but these errors were encountered: