-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: wait for disconnect in disconnect_p2ps + bloomfilter test followups #19252
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
3cf21fb
to
3d9ae8d
Compare
f9bf0d1
to
628227f
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
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.
Code review ACK 628227f
A couple of small style suggestions inline. Feel free to take or ignore.
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.
Tested ACK with a couple of minor suggestions and a possible concern.
In f1dbb84 consider adding explanation (why, tradeoffs, etc.) for the change in the commit message (like the content of the comment mentioned in the PR description), so future us searching through git history won't have to look up the PR description and then find the linked comment on GitHub, which is only GitHub-specific metadata and not stored in git history.
In the afad631 consider not linking in the commit message to GitHub metadata, e.g. PRs, comments, @-usernames (I used to do it, but it can leave a messy trail).
Concern: possible slowdown in test run times of ~10% in tests with wait_for_disconnect
. See details that follow.
test run times
in test_runner.py
BASE_SCRIPTS = [
'feature_maxuploadtarget.py',
'p2p_blockfilters.py',
'p2p_blocksonly.py',
'p2p_dos_header_tree.py',
'p2p_invalid_locator.py',
'p2p_invalid_messages.py',
'p2p_leak.py',
'p2p_nobloomfilter_messages.py',
'p2p_node_network_limited.py',
'p2p_sendheaders.py',
'p2p_unrequested_blocks.py',
]
this branch
TEST | STATUS | DURATION
feature_maxuploadtarget.py | ✓ Passed | 92 s
p2p_blockfilters.py | ✓ Passed | 98 s
p2p_blocksonly.py | ✓ Passed | 4 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 3 s
p2p_invalid_messages.py | ✓ Passed | 103 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 19 s
p2p_sendheaders.py | ✓ Passed | 16 s
p2p_unrequested_blocks.py | ✓ Passed | 10 s
ALL | ✓ Passed | 357 s (accumulated)
Runtime: 110 s
feature_maxuploadtarget.py | ✓ Passed | 93 s
p2p_blockfilters.py | ✓ Passed | 92 s
p2p_blocksonly.py | ✓ Passed | 7 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 2 s
p2p_invalid_messages.py | ✓ Passed | 94 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 17 s
p2p_sendheaders.py | ✓ Passed | 18 s
p2p_unrequested_blocks.py | ✓ Passed | 8 s
ALL | ✓ Passed | 343 s (accumulated)
Runtime: 100 s
feature_maxuploadtarget.py | ✓ Passed | 95 s
p2p_blockfilters.py | ✓ Passed | 102 s
p2p_blocksonly.py | ✓ Passed | 4 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 3 s
p2p_invalid_messages.py | ✓ Passed | 100 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 18 s
p2p_sendheaders.py | ✓ Passed | 18 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 361 s (accumulated)
Runtime: 104 s
feature_maxuploadtarget.py | ✓ Passed | 97 s
p2p_blockfilters.py | ✓ Passed | 96 s
p2p_blocksonly.py | ✓ Passed | 17 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 2 s
p2p_invalid_messages.py | ✓ Passed | 97 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 17 s
p2p_sendheaders.py | ✓ Passed | 18 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 365 s (accumulated)
Runtime: 103 s
feature_maxuploadtarget.py | ✓ Passed | 95 s
p2p_blockfilters.py | ✓ Passed | 97 s
p2p_blocksonly.py | ✓ Passed | 7 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 3 s
p2p_invalid_messages.py | ✓ Passed | 96 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 16 s
p2p_sendheaders.py | ✓ Passed | 17 s
p2p_unrequested_blocks.py | ✓ Passed | 10 s
ALL | ✓ Passed | 353 s (accumulated)
Runtime: 103 s
master
TEST | STATUS | DURATION
feature_maxuploadtarget.py | ✓ Passed | 94 s
p2p_blockfilters.py | ✓ Passed | 95 s
p2p_blocksonly.py | ✓ Passed | 16 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 3 s
p2p_invalid_messages.py | ✓ Passed | 80 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 16 s
p2p_sendheaders.py | ✓ Passed | 17 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 342 s (accumulated)
Runtime: 95 s
feature_maxuploadtarget.py | ✓ Passed | 96 s
p2p_blockfilters.py | ✓ Passed | 99 s
p2p_blocksonly.py | ✓ Passed | 7 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 3 s
p2p_invalid_messages.py | ✓ Passed | 84 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 17 s
p2p_sendheaders.py | ✓ Passed | 18 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 345 s (accumulated)
Runtime: 99 s
feature_maxuploadtarget.py | ✓ Passed | 93 s
p2p_blockfilters.py | ✓ Passed | 94 s
p2p_blocksonly.py | ✓ Passed | 7 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 2 s
p2p_invalid_messages.py | ✓ Passed | 79 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 16 s
p2p_sendheaders.py | ✓ Passed | 18 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 330 s (accumulated)
Runtime: 94 s
feature_maxuploadtarget.py | ✓ Passed | 94 s
p2p_blockfilters.py | ✓ Passed | 97 s
p2p_blocksonly.py | ✓ Passed | 15 s
p2p_dos_header_tree.py | ✓ Passed | 3 s
p2p_invalid_locator.py | ✓ Passed | 2 s
p2p_invalid_messages.py | ✓ Passed | 80 s
p2p_leak.py | ✓ Passed | 7 s
p2p_nobloomfilter_messages.py | ✓ Passed | 2 s
p2p_node_network_limited.py | ✓ Passed | 17 s
p2p_sendheaders.py | ✓ Passed | 17 s
p2p_unrequested_blocks.py | ✓ Passed | 9 s
ALL | ✓ Passed | 343 s (accumulated)
Runtime: 97 s
(The number of test run samples is too small, but it might be interesting to look further into it.) |
Hm :/ that slowdown seems pretty significant. I've thought of 2 possible solutions:
It's a common pattern to test using multiple mininodes, one at a time, and call Thus, I think it would be better to use What I suggest, for this PR, is to add a default |
628227f
to
8386ad5
Compare
Ok, I made waiting optional/default False which should theoretically make a good dent in the performance problems. Went through and added a couple |
Maybe the node.p2p property should be removed if it is causing so much trouble and complexity. There should be no downside to removing it unless I am missing something. Moreover, writing If a connection is used in multiple sub-tests, a member variable could be used like |
@jonatack your test runs seem extraordinarily slow. Are you running under bitcoind with some additional debug instrumentation? Here are the same tests in my vm for comparison: test run times
Master:
This branch (with the default
so with a sample size of 1, there' no observable difference. If your bitcoinds are generally slow, then disconnecting peers may be slow, but generally it should be pretty quick and not contribute to test times significantly. I think this needs more testing, but if others are able to replicate my results, then I'd vote for not adding the |
Isolated the issue 🤦 Rebasing this PR onto 49236be or current master, re-ACK 628227f (without the extra param) |
-Use peer to refer to mininodes instead of node because they are not bitcoind nodes. -Use log.debug for logs that give helpful but not super necessary information. -Adhere to style guidelines (newlines, capitalization).
-Waiting is important to avoid race conditions, especially if testing peer info through rpc later. -Wait for mininodes to be disconnected only, even though it's more complex, because we may still want to be connected to test nodes.
-Use wait_for_disconnect instead of manual wait after calling disconnect_p2ps.
8386ad5
to
9a40cfc
Compare
Rebased and addressed comments. Got rid of My run times ¯\_(ツ)_/¯Master:
This branch:
|
Code review ACK 9a40cfc from re-reviewing the diff and |
ACK 9a40cfc 🐂 Show signature and timestampSignature:
Timestamp of file with hash |
…ovements 56010f9 test: hoist p2p values to test framework constants (Jon Atack) 75447f0 test: improve msg sends and p2p disconnections in p2p_invalid_messages (Jon Atack) 5796019 test: refactor test_large_inv() into 3 tests with common method (Jon Atack) e2b21d8 test: add p2p_invalid_messages logging (Jon Atack) 9fa494d net: update misbehavior logging for oversized messages (Jon Atack) Pull request description: ...seen while reviewing #19264, #19252, #19304 and #19107: in `net_processing.cpp` - make the debug logging for oversized message size misbehavior the same for `addr`, `getdata`, `headers` and `inv` messages in `p2p_invalid_messages` - add missing logging - improve assertions/message sends, move cleanup disconnections outside the assertion scopes - split a slowish 3-part test into 3 order-independent tests - add a few p2p constants to the test framework ACKs for top commit: troygiorshev: reACK 56010f9 MarcoFalke: ACK 56010f9 🎛 Tree-SHA512: db67b70278f8d4c318907e105af54b54eb3afd15500f9aa0c98034f6fd4bd1cf9ad1663037bd9b237ff4890f3059b37291a6498d8d6ae2cc38efb9f045f73310
…filter test followups Summary: 9a40cfc558b3f7fa4fff1270f969582af17479a5 [refactor] use waiting inside disconnect_p2ps (gzhao408) aeb9fb414e2d000830287d9dd3fed7fc2eb570d2 [test] wait for disconnect_p2ps to be reflected in getpeerinfo (gzhao408) e81942d2e1288367e8da94adb2b2a88be99e4751 [test] logging and style followups for bloomfilter tests (gzhao408) Pull request description: Followup to #19083 which adds bloomfilter-related tests. 1. Make test_node `disconnect_p2ps` wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's [comment](bitcoin/bitcoin#19083 (comment)). And clean up any redundant `wait_until`s in the functional tests. 2. Clean up style + logging in p2p_filter.py and p2p_nobloomfilter_messages.py and jonatack's other [comments](bitcoin/bitcoin#19083 (review)) --- Backport of [[bitcoin/bitcoin#19252 | core#19252]] Depends on D9512 Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9513
Followup to #19083 which adds bloomfilter-related tests.
disconnect_p2ps
wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's comment. And clean up any redundantwait_until
s in the functional tests.