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 deadlock in GetRewardsAccumulated #49

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Conversation

hyeonLewis
Copy link
Contributor

Proposed changes

This PR is on top of #48

GetRewardsAccumulated has deadlock at reqCh<-num when len(errCh)>numWorkers since non-nil error closes goroutine. This PR makes separate goroutine for requests.

Console test
// Before PR
> governance.getRewardsAccumulated(700, 701)
Error: missing trie node e58fbf31ca5b4a4c5e2435f37fa0e87bbec954f1900d2f4da9810eab9b39214b (path )
	at web3.js:6812:9(39)
	at send (web3.js:5223:62(29))
	at <eval>:1:33(4)

> governance.getRewardsAccumulated(700, 1700)
...
^ deadlock occurs

// After PR
> governance.getRewardsAccumulated(700, 1700)
Error: missing trie node 31371ed81cf6c6d0df48d2b5d61414a6e695aa6390f45fef50290d3d13295021 (path )
	at web3.js:6812:9(39)
	at send (web3.js:5223:62(29))
	at <eval>:1:33(4)

> governance.getRewardsAccumulated(700, 701)
Error: missing trie node e58fbf31ca5b4a4c5e2435f37fa0e87bbec954f1900d2f4da9810eab9b39214b (path )
	at web3.js:6812:9(39)
	at send (web3.js:5223:62(29))
	at <eval>:1:33(4)

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribute
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@hyeonLewis hyeonLewis self-assigned this Jul 17, 2024
@hyeonLewis hyeonLewis force-pushed the fix-getRewardsAccumulated branch from f0136a7 to 21a8563 Compare July 17, 2024 02:05
@hyeonLewis hyeonLewis marked this pull request as ready for review July 17, 2024 02:05
@hyeonLewis hyeonLewis force-pushed the fix-getRewardsAccumulated branch from 21a8563 to 10d7172 Compare July 17, 2024 02:23
@blukat29 blukat29 requested a review from yoomee1313 July 17, 2024 04:29
@blukat29
Copy link
Contributor

@yoomee1313 @ian0371 PTAL

@blukat29 blukat29 merged commit 9aadb8e into dev Jul 17, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
@hyeonLewis hyeonLewis deleted the fix-getRewardsAccumulated branch July 18, 2024 03:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants