Navigation Menu

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

Race Condition with SetReportCaller() #954

Closed
jeremyje opened this issue Apr 17, 2019 · 4 comments
Closed

Race Condition with SetReportCaller() #954

jeremyje opened this issue Apr 17, 2019 · 4 comments

Comments

@jeremyje
Copy link

It looks like there's a data race condition between SetReportCaller and internal reads from entry.go.

https://github.com/sirupsen/logrus/blob/master/entry.go#L220 and https://github.com/sirupsen/logrus/blob/master/entry.go#L200 are 2 probable culprits here.

Step #8 - "Build: Test": ==================
Step #8 - "Build: Test": WARNING: DATA RACE
Step #8 - "Build: Test": Write at 0x00c00003c208 by goroutine 67:
Step #8 - "Build: Test":   github.com/sirupsen/logrus.(*Logger).SetReportCaller()
Step #8 - "Build: Test":       /go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/logger.go:341 +0x85
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/internal/serving/testing.createOpenMatchServer()
Step #8 - "Build: Test":       /go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/exported.go:31 +0xf6
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/internal/serving/testing.NewMiniMatch()
Step #8 - "Build: Test":       /workspace/internal/serving/testing/minimatch.go:65 +0x6d
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/test/e2e/frontend.TestFrontendStartup()
Step #8 - "Build: Test":       /workspace/test/e2e/frontend/frontendapi_test.go:13 +0x76
Step #8 - "Build: Test":   testing.tRunner()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:865 +0x163
Step #8 - "Build: Test": 
Step #8 - "Build: Test": Previous read at 0x00c00003c208 by goroutine 62:
Step #8 - "Build: Test":   github.com/sirupsen/logrus.Entry.log()
Step #8 - "Build: Test":       /go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:220 +0x1c2
Step #8 - "Build: Test":   github.com/sirupsen/logrus.(*Entry).Log()
Step #8 - "Build: Test":       /go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:268 +0x160
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/internal/serving.(*GrpcWrapper).Start.func1()
Step #8 - "Build: Test":       /go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:297 +0x359
Step #8 - "Build: Test": 
Step #8 - "Build: Test": Goroutine 67 (running) created at:
Step #8 - "Build: Test":   testing.(*T).Run()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:916 +0x65a
Step #8 - "Build: Test":   testing.runTests.func1()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:1157 +0xa8
Step #8 - "Build: Test":   testing.tRunner()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:865 +0x163
Step #8 - "Build: Test":   testing.runTests()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:1155 +0x523
Step #8 - "Build: Test":   testing.(*M).Run()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:1072 +0x2eb
Step #8 - "Build: Test":   main.main()
Step #8 - "Build: Test":       _testmain.go:84 +0x334
Step #8 - "Build: Test": 
Step #8 - "Build: Test": Goroutine 62 (running) created at:
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/internal/serving.(*GrpcWrapper).Start()
Step #8 - "Build: Test":       /workspace/internal/serving/grpcserver.go:61 +0x581
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/internal/serving/testing.NewMiniMatch()
Step #8 - "Build: Test":       /workspace/internal/serving/omserver.go:28 +0xfd
Step #8 - "Build: Test":   github.com/GoogleCloudPlatform/open-match/test/e2e/frontend.TestFrontendStartup()
Step #8 - "Build: Test":       /workspace/test/e2e/frontend/frontendapi_test.go:13 +0x76
Step #8 - "Build: Test":   testing.tRunner()
Step #8 - "Build: Test":       /usr/local/go/src/testing/testing.go:865 +0x163
@jeremyje
Copy link
Author

The fix has a risk to be breaking because ReportCaller bool is a public field on the Logger structs. This field being set is protected by a mutex but the reads are not.

@stale
Copy link

stale bot commented Feb 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 26, 2020
@AlekSi
Copy link

AlekSi commented Feb 26, 2020

It is a real unfixed problem.

@markphelps
Copy link
Collaborator

Fixed by #1116

cgxxv pushed a commit to cgxxv/logrus that referenced this issue Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants