-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Fix race condition in index prune test #25123
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
theStack
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.
Concept ACK
Is there an explanation why this race is only (or at least, much more likely, it seems) happening on Windows? If someone knows how to reproduce the fixed failure behaviour on a Linux/BSD system, would be nice to know.
Agree, it would be nice to be sure :) My assumption is that the Windows build is just slower than everything else and that's why we have only seen it there so far. Looking at https://cirrus-ci.com/github/bitcoin/bitcoin it always seems the be the job that takes the longest time. |
maflcko
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.
why should addconnection be less racy than connect?
Why not use connect_nodes which has the wait_until built into? #25031 (comment)
|
It should be possible to reproduce by adding a sleep in the |
|
I was able to reproduce the issue as well with this, thanks @MarcoFalke !
From my understanding of the code
Right, I can replace |
f42e25b to
cfb807c
Compare
Nodes are restarted and reconnected as part of the test. Afterwards `sync_blocks` is called immediately on the nodes. `sync_blocks` first checks that all the included nodes have at least one connection. Since adding a connection is usually happening in a thread, sometimes nodes could run into this check before the connection was fully established so that it would fail the entire test. This fix uses the `connect_nodes` helper to make the connection the nodes. `connect_nodes` has a wait for the connection built into it.
cfb807c to
4faa550
Compare
|
Updated to use |
|
If |
Yeah, I was thinking about that as well. I will give it a try and benchmark. |
4faa550 test: Fix race condition in index pruning test (Fabian Jahr) Pull request description: Fixes bitcoin#25031 The `feature_index_prune.py` test seems to be racy because connections are reestablished after restarts and the blocks are synced via the `sync_blocks` function. The `sync_blocks` function has a sanity check at the beginning to check that all nodes in the set have at least one established connection and that is not always the case. As a solution nodes are not connected via the `-connect` parameter on start but instead via the `connect_nodes` helper. Top commit has no ACKs. Tree-SHA512: f88377715f455f1620725fe8ebd6b486fa0209660b193bf68d1ce1452e2086ac5d169d8ca4c2b61443566232e96fb9c6386ee482bc546cce38078d72e7c3c29f
Fixes #25031
The
feature_index_prune.pytest seems to be racy because connections are reestablished after restarts and the blocks are synced via thesync_blocksfunction. Thesync_blocksfunction has a sanity check at the beginning to check that all nodes in the set have at least one established connection and that is not always the case.As a solution nodes are not connected via the
-connectparameter on start but instead via theconnect_nodeshelper.