-
Notifications
You must be signed in to change notification settings - Fork 495
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
miner: reset ctx timeout before commit tx on new tx notif #1434
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1434 +/- ##
========================================
Coverage 50.36% 50.36%
========================================
Files 771 771
Lines 125119 125120 +1
========================================
+ Hits 63013 63022 +9
+ Misses 58099 58077 -22
- Partials 4007 4021 +14 ☔ View full report in Codecov by Sentry. |
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.
Would it be possible to add a test for it? Otherwise we might run into the same issue again in the future after refactoring.
@cffls it's a bit difficult to test this via a unit test because every test is from a validator's perspective and one never receives the trigger to mine via the new transaction channel (because the The fix above only applies to sentry and it's not possible to test it (at leasts from the worker module where we can access the low level functions). |
Description
A recent refactor in miner module caused an internal sentry node to continuously print the following logs:
On further investigation, this channel in main loop always used to trigger a call to commit transactions.
bor/miner/worker.go
Line 606 in d1219ff
Because we use a shared context throughout the worker, it used to set an already timed out context which used to trigger this.
bor/miner/worker.go
Line 940 in d1219ff
Moreover, this case is to build blocks after the main
commitWork
is completed and there are some new transactions which can be filled. Hence, we individually process these transactions as we receive them. Currently, we don't honour commit interrupt which means that a heavy transaction can consume lot of time.Hence, before calling commit, we first check if we still have time to process using header's timestamp. If we do, we set the context with a timeout so that if it takes time to execute, we interrupt the process on time.
Changes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it