-
Notifications
You must be signed in to change notification settings - Fork 241
Fix race conditions on log when accessing scope #1050
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1050 +/- ##
==========================================
+ Coverage 86.88% 87.08% +0.20%
==========================================
Files 55 55
Lines 5956 5971 +15
==========================================
+ Hits 5175 5200 +25
+ Misses 638 630 -8
+ Partials 143 141 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There seem to be some more places where both the hub and scope are used without using the new function which could possibly still lead to race conditions, as an example:
I would suggest reviewing all usages of |
da78b31
to
1065b95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, please see the comments
@lcian For the cursor comment about nil scope. If you clone the Hub and scope should never be empty. We can still guard with nil checks on the |
Yep I see. I was talking about this one: #1050 (comment) |
hub_test.go
Outdated
@@ -553,3 +555,19 @@ func TestHub_FlushWithContext(t *testing.T) { | |||
t.Fatalf("expected message to be %v, got %v", wantEvent.Message, gotEvents[0].Message) | |||
} | |||
} | |||
|
|||
func TestHubEmptyClientShouldBeSafe(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That the hub shouldn't panic with an empty client 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we use a a test name with proper grammar then?
efce555
to
add4c8a
Compare
add4c8a
to
89a6da5
Compare
1ffac9d
to
c5f1c00
Compare
Closes both #1048 and #1049.
Description
Adds tests for the logger to identify race conditions and fix everything uncovered.
Changes include:
SetAttributes
to guard for panics.log
.