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

fix race condition #2013

Open
wants to merge 1 commit into
base: v6.0.1-hotfix-rpc-8-branch
Choose a base branch
from

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Dec 30, 2024

Describe your changes and provide context

Testing performed to validate your change

@@ -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()
Copy link
Contributor

@yzang2019 yzang2019 Dec 30, 2024

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
Copy link
Contributor

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

Copy link
Collaborator Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense to me

@codchen codchen changed the base branch from v6.0.1-hotfix-rpc-8-branch to main January 2, 2025 04:38
@codchen codchen changed the base branch from main to v6.0.1-hotfix-rpc-8-branch January 2, 2025 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants