Closed tayfunelmas closed 1 week ago
Attention: Patch coverage is 91.35802%
with 7 lines
in your changes missing coverage. Please review.
Project coverage is 71.68%. Comparing base (
af022d8
) to head (03dfd7a
).
Files | Patch % | Lines |
---|---|---|
chain/chain/src/block_processing_utils.rs | 90.78% | 6 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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: https://github.com/near/nearcore/blob/71d35d9921603d8dea60fcc41c0d5478202fc574/chain/chain/src/chain.rs#L295
However that wait does not end, since setter runs after apply-blocks is finished: https://github.com/near/nearcore/blob/71d35d9921603d8dea60fcc41c0d5478202fc574/chain/chain/src/chain.rs#L1831
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.