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

core/bloombits: fix deadlock when matcher session hits an error #899

Merged
merged 2 commits into from
Sep 26, 2023
Merged

core/bloombits: fix deadlock when matcher session hits an error #899

merged 2 commits into from
Sep 26, 2023

Conversation

msmania
Copy link
Contributor

@msmania msmania commented Sep 25, 2023

Why this should be merged

A block-pruned node encounters deadlock if a node receives eth_getLogs for a pruned block. The node will eventually be killed because deadlocked goroutines do not release system resources.

With this patch, such eth_getLogs immediately returns a jsonrpc error.

How this works

This patch has been merged in the upstream and will be included in the next version v1.13.2. More technical details are described in the original PR ethereum/go-ethereum#28184.

How this was tested

We had this deadlock in our DFK Chain node. This patch fixed it.

How is this documented

No change is needed.

When MatcherSession encounters an error, it attempts to close the session.
Closing waits for all goroutines to finish, including the 'distributor'.
However, the distributor will not exit until all requests have returned.

This patch fixes the issue by delivering the (empty) result to the distributor
before calling Close().
Copy link
Collaborator

@darioush darioush left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @msmania. would you also like to make the same PR to https://github.com/ava-labs/coreth ? If not we will port the change there as well.

@msmania
Copy link
Contributor Author

msmania commented Sep 25, 2023

lgtm, thanks @msmania. would you also like to make the same PR to https://github.com/ava-labs/coreth ? If not we will port the change there as well.

Thanks @darioush ! I created a PR there.

Copy link
Collaborator

@aaronbuchwald aaronbuchwald left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the fix and porting it over!

@aaronbuchwald aaronbuchwald merged commit d72504d into ava-labs:master Sep 26, 2023
7 of 8 checks passed
@msmania msmania deleted the bugfix-deadlock-eth_getLogs branch September 27, 2023 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants