-
Notifications
You must be signed in to change notification settings - Fork 629
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
Change apply-chunk tracker implementation #11653
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11653 +/- ##
==========================================
+ Coverage 71.66% 71.68% +0.01%
==========================================
Files 788 788
Lines 161300 161374 +74
Branches 161300 161374 +74
==========================================
+ Hits 115589 115674 +85
+ Misses 40674 40659 -15
- Partials 5037 5041 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
saketh-are
approved these changes
Jun 26, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 17, 2024
Previously, #11653 introduced a mechanism where a maximum timeout was used in `impl Drop for Chain`, but that only works if the testloop feature is enabled, which most likely is not the case when someone just runs a test. This PR switches to an alternative implementation; not only is it simpler, but it also automatically works. If the TestLoop panics, it will be dropped first. When it is dropped, it ensures that all pending events are dropped, thereby dropping the ApplyChunksStillApplying struct, making the subsequent waiter.wait() call go through when we're recursively dropping the Chain. Confirmed that this fixes #11840 as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #11447, if there is a panic (due to assertion failure) when running testloop locally, the test freezes instead of reporting the failure. This makes it difficult to run testloop in cases where we want to debug an assertion failure.
The reason for the freezing test failures is that the panic causes the objects be dropped and the drop handler for Chain blocks, waiting apply-chunks be finished:
nearcore/chain/chain/src/chain.rs
Line 295 in 71d35d9
However that wait does not end, since setter runs after apply-blocks is finished:
nearcore/chain/chain/src/chain.rs
Line 1831 in 71d35d9
And it does not get a chance to notify the waiters. For example, commenting out the drop handler for the Chain allows us to see the assertion failure, as expected.
To handle this for testloop, we change the implementation as follows:
Note: We could also use a technique such as
oneshot::Receiver
, in which case the waiter will just return whenever the sender is dropped, but it works withasync
computations only, whereas the apply-chunks is executed in a multi-threaded fashion.