You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SetLogger/ClearLogger/SetFilter lock logging.mu, which implies that they were meant to be concurrency-safe. However, several other functions access the underlying fields without locking, so that protection is currently useless.
add mutex locking to all package-level functions (will cause additional overhead!) or
clarify that SetLogger/ClearLogger/SetFilter are meant to be called while it is safe to do so (typically during program init before starting goroutines)
The text was updated successfully, but these errors were encountered:
I'm leaning towards updating the documentation and not adding mutex locking. That seems more useful in practice and in particular will not make klog worse for those who don't use SetLogger or SetFilter.
I agree with documentation update as it follows original intention of those functions being called once during initial program setup by only one goroutine.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/kind bug
What steps did you take:
Code reading...
What did you expect to happen:
SetLogger/ClearLogger/SetFilter lock logging.mu, which implies that they were meant to be concurrency-safe. However, several other functions access the underlying fields without locking, so that protection is currently useless.
klog/klog.go
Lines 1398 to 1428 in e7e4115
klog/klog.go
Line 1550 in e7e4115
We can either:
The text was updated successfully, but these errors were encountered: