-
Notifications
You must be signed in to change notification settings - Fork 18k
log: race between SetFlag and Output #21935
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
Comments
Change https://golang.org/cl/64710 mentions this issue: |
Re-open for possible cherry-pick (for Go1.9 regression) |
Sorry for this😰 |
Mistakes happen. Most users probably never hit this issue. Hot-swapping the flag value is a rare use-case in my opinion. |
We just hit this. Caused in our case by spawning a goroutine during
|
CL 64710 OK for Go 1.9.2. |
Change https://golang.org/cl/70976 mentions this issue: |
There was unprotected access to Logger.flag in log.Output which could lead to data race in cases when log.SetFlags called simultaneously. For example, "hot" switching on/off debug-mode for Logger by log.SetFlags while application still writing logs. Fixes #21935 Change-Id: I36be25f23cad44cde62ed1af28a30d276400e1b8 Reviewed-on: https://go-review.googlesource.com/64710 Reviewed-by: Joe Tsai <[email protected]> Run-TryBot: Joe Tsai <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-on: https://go-review.googlesource.com/70976 Run-TryBot: Russ Cox <[email protected]>
go1.9.2 has been packaged and includes: The release is posted at golang.org/dl. — golang.org/x/build/cmd/releasebot, Oct 26 21:09:15 UTC |
CL/38056 introduced a regression where
l.flag
was accessed outside of the protection ofl.mu
, which can cause a race withSetFlag
:go/src/log/log.go
Lines 152 to 154 in 4cf19fb
A fix for this has been sent in CL/64710, but I'm opening an issue to consider cherry picking this into go1.9.1.
\cc @BoGeM
The text was updated successfully, but these errors were encountered: