-
Notifications
You must be signed in to change notification settings - Fork 817
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
fix race condition #2013
base: v6.0.1-hotfix-rpc-8-branch
Are you sure you want to change the base?
fix race condition #2013
Conversation
@@ -349,6 +349,8 @@ func (f *LogFetcher) GetLogsByFilters(ctx context.Context, crit filters.FilterCr | |||
defer wg.Done() | |||
defer func() { | |||
if r := recover(); r != nil { | |||
mu.Lock() |
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.
Is this being hit at all? I think recover() should never be hit in this logic, and it shouldn't be causing any dead lock issue from my understanding. That being said, adding the lock wouldn't hurt as well
// Aggregate results into the final slice | ||
for result := range resultsChan { | ||
res = append(res, result) | ||
} | ||
|
||
// Check err after all work is done |
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.
This ordering adjustment make sense to me, but I wonder why it would lead to dead lock or stuck issue
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.
I think it'd cause the errorsList = append(errorsList, berr)
above to run into undefined behavior which then causes some weirdness
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.
make sense to me
Describe your changes and provide context
Testing performed to validate your change