-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Restore unlimited timeout in IndexWaitSynced #28036
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
Conversation
The timeout was unlimited before, so just restore that value for now: bitcoin#27988 (comment)
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
furszy
left a comment
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.
|
Thx, edited OP |
|
Little note: I think that the only downside here with respect to increasing the timeout to a much higher number or #28026 is that the tests could run forever if the index |
|
We've been plagued by intermittent timeouts locally (for months/years) and now in CI (for days), but never a thread that never finished. So I think it should be evident that this or ##28026 should be preferred. After all, it is no different than any other deadlock or infinite loop anywhere else in the code. |
|
Actually, it is not when the thread never finishes. The thread could have finished, but never set the |
|
utACK fabed7e Could also restore the original behaviour by doing something like: void IndexWaitSynced(BaseIndex& index, std::chrono::microseconds timeout)
{
const auto end = SteadyClock::now() + timeout;
while (!index.BlockUntilSyncedToCurrentChain()) {
Assert(timeout <= 0s || SteadyClock::now < end);
UninterruptibleSleep(100ms);
}
}and calling |
|
ACK fabed7e as per #28026 (review) I like this approach more than running the sync synchronously.
The problem in the first place was that that the tests for txindex and blockfilterindex would have rare intermittent timeouts. So instead of making guesses about the slowest environment the tests could be run in I think it's ok to just have no timeout. |
Good point. Though, that seems like a bigger problem of the unit tests not handling AbortNode/FatalError/StartShutdown at all? |
The quickest fix would be to add a In this way, we can be guarded against the infinite loop. And also verify the index synchronization result (which must be always successful). The "AbortNode/FatalError/StartShutdown" treatment on the tests topic seems to be a different problem that we should aboard in the future, yeah. Here the test main thread will actively-wait for a flag to be set, and the flag could never be set. So, even if we start handling "AbortNode/FatalError/StartShutdown" on the base tests class, the error would need to be handled by a different thread (not sure if we already have something for it). |
fabed7e test: Restore unlimited timeout in IndexWaitSynced (MarcoFalke) Pull request description: The timeout was unlimited before, so just restore that value for now: bitcoin#27988 (comment) . (Strictly speaking, this is a behavior change for the blockfilterindex and txindex tests, because it only restores the coinstatsindex behavior.) ACKs for top commit: ajtowns: utACK fabed7e mzumsande: ACK fabed7e furszy: ACK fabed7e Tree-SHA512: 66a878be58bbe53ad8e0c23f05569dd42df688be747551fbd202ada22d20a8285714e58fa2a71664deadb070ddf86cfad88c01042ff95ed26f6b40e4a10cec0a
89ba890 test: indexes, fix on error infinite loop (furszy) Pull request description: Coming from bitcoin/bitcoin#28036 (comment), I thought that we were going to fix it there but seems that got merged without it for some reason. As index sync failures trigger a shutdown request without notifying `BaseIndex::BlockUntilSyncedToCurrentChain` in any way, we also need to check whether a shutdown was requested or not inside 'IndexWaitSynced'. Otherwise, any error inside the index sync process will hang the test forever. ACKs for top commit: MarcoFalke: lgtm ACK 89ba890 jamesob: ACK 89ba890 ryanofsky: Code review ACK 89ba890. Just comment update since last review Tree-SHA512: 1f6daf34e51d3fbc802799bfa4ac0ef0d8f774db5f9e2f5d35df18a77679778475c94efc3da1fb723ebaf3583e4075e4a5cbe4a5104ad0c50e2b32076e247b29
89ba890 test: indexes, fix on error infinite loop (furszy) Pull request description: Coming from bitcoin#28036 (comment), I thought that we were going to fix it there but seems that got merged without it for some reason. As index sync failures trigger a shutdown request without notifying `BaseIndex::BlockUntilSyncedToCurrentChain` in any way, we also need to check whether a shutdown was requested or not inside 'IndexWaitSynced'. Otherwise, any error inside the index sync process will hang the test forever. ACKs for top commit: MarcoFalke: lgtm ACK 89ba890 jamesob: ACK 89ba890 ryanofsky: Code review ACK 89ba890. Just comment update since last review Tree-SHA512: 1f6daf34e51d3fbc802799bfa4ac0ef0d8f774db5f9e2f5d35df18a77679778475c94efc3da1fb723ebaf3583e4075e4a5cbe4a5104ad0c50e2b32076e247b29
The timeout was unlimited before, so just restore that value for now: #27988 (comment) .
(Strictly speaking, this is a behavior change for the blockfilterindex and txindex tests, because it only restores the coinstatsindex behavior.)