-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 ExecuteTextString #3277
Comments
I've just spent some more time looking into the cause of this issue, and I think the issue is that the
I have been able to replicate this in a simple Go program:
Here is an example of the output:
|
If we look at the docs for https://pkg.go.dev/golang.org/x/text/cases#Caser
I think we either need to change |
It seems like I don't think it's worth locking the whole of |
I agree! It looks like this issue can be fixed with a new caser for each function call:
|
There was a similar bug not long ago - it manifested as panics: #3064 If there are any other cases (heh) where a Caser is re-used they should also be updated to discard and create a new caser instead. |
What did you do?
I have been looking into a data corruption issue in Slack notifications in Grafana (grafana/grafana#63584) and have found a race condition in
ExecuteTextString
in Alertmanager that I suspect to be the cause. I have been able to reproduce this bug inmain
, commit41eb121
.I have the following Alertmanager configuration:
and the following template in
test.tmpl
:I created a single rule that has 4 alert instances:
What did you expect to see?
I expected to see the following in all messages:
What did you see instead? Under which circumstances?
However most messages are corrupted. For example:
I think the issue is related to how Alertmanager uses
text/template
across goroutine as the bug is no longer reproducible with the following changes:The text was updated successfully, but these errors were encountered: