Skip to content
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

Fixes races in multiline stage and promtail. #3302

Merged
merged 2 commits into from
Feb 16, 2021

Conversation

cyriltovena
Copy link
Contributor

Not fully sure how this was happening, but I have a test showing it's possible and a fix for it.

I think it should fix #3120.

I also remove race within some tests of promtail.

/cc @jeschkies WDYT ?

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

Not fully sure how this was happening, but I have a test showing it's possible and a fix for it.

I think it should fix grafana#3120.

I also remove race within some tests of promtail.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
collapsed := Entry{
Extracted: s.startLineEntry.Extracted,
Extracted: extracted,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. I thought Extracted would be a value not a reference. few minutes googling later

Ok, maps are references, see https://blog.golang.org/maps:

Map types are reference types, like pointers or slices, and so the value of m above is nil; it doesn't point to an initialized map.

🤦

So either we send a copy across the channel. Or we reset the entry but that would be a little bit more complicated.

@cyriltovena cyriltovena mentioned this pull request Feb 11, 2021
@chancez
Copy link
Contributor

chancez commented Feb 12, 2021

This looks like it worked! I ran the original test-case I was using before on master, it panics literally immediately, and after switching to a build of promtail from this branch, it's running through the logs, updating my cursor, etc, no panic.

Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Should enable go build -race? I wonder if it would have caught this one.

@cyriltovena cyriltovena merged commit 9e33f8f into grafana:master Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promtail crashing
4 participants