MarcoFalke
commented at 2:39 pm on November 10, 2020:
member
The most frequent failure in functional tests are intermittent races. Fixing such bugs is cumbersome because it involves:
Noticing the failure
Fetching and reading the log to determine the test case that failed
Adding a self.sync_all() where it was forgotten
Spamming out a pr and waiting for review, which is already sparse
Also, writing a linter to catch those is not possible, nor is review effective in finding these bugs prior to merge.
Fix all future intermittent races caused by a missing sync_block call by calling sync_all implicitly after each generate*, unless opted out. This ensures that the code is race-free (with regards to blocks) when the tests pass once, instead of our current approach where the code can never be guaranteed to be race-free.
DrahtBot
commented at 3:43 pm on November 10, 2020:
member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#22567 (test: Implicitly sync after generate* to preempt races and intermittent test failures by MarcoFalke)
#22437 (test, refactor: add GetTransaction() coverage, improve rpc_rawtransaction by jonatack)
#22364 (wallet: Make a tr() descriptor by default by achow101)
#22229 (test: consolidate to f-strings (part 1) by fanquake)
#10102 ([experimental] Multiprocess bitcoin by ryanofsky)
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.
practicalswift
commented at 3:53 pm on November 10, 2020:
contributor
Concept ACK: thanks for doing this - intermittent test failures are the worst!
Bike shed nit: fn or func might be more unambiguous (but less fun) abbreviations than fun :)
DrahtBot added the label
Tests
on Nov 10, 2020
MarcoFalke force-pushed
on Nov 10, 2020
MarcoFalke force-pushed
on Nov 10, 2020
MarcoFalke force-pushed
on Nov 12, 2020
in
test/functional/test_framework/test_node.py:303
in
faf4ef6b4boutdated
Maybe I am misunderstanding. Do you have a working diff that I can steal?
in
test/functional/test_framework/test_framework.py:459
in
fa014d2ce4outdated
455@@ -456,6 +456,7 @@ def get_bin_from_version(version, bin_name, bin_default):
456 assert_equal(len(binary_cli), num_nodes)
457 for i in range(num_nodes):
458 test_node_i = TestNode(
459+ self,
promag
commented at 10:49 am on November 14, 2020:
fa014d2ce4b37f04cdecf8f318cb0cf98f30c050
An alternative to avoid this circular dependency is to refactor as self.generate(nodes[1], 1) or self.generate(1, 1) , similarly to self.start_node(0).
MarcoFalke
commented at 7:34 am on November 15, 2020:
I didn’t do that because self.generate(1, 1) looks unreadable. Enforcing named args makes everything verbose.
It seems a bit ugly to have this bidirectional reference between the framework and the test nodes.
Would it be sufficient to instead pass and store a lambda “sync function”?
MarcoFalke
commented at 9:44 am on December 19, 2020:
Thanks, done
MarcoFalke force-pushed
on Dec 19, 2020
MarcoFalke force-pushed
on Dec 19, 2020
MarcoFalke removed this from the "Blockers" column in a project
DrahtBot added the label
Needs rebase
on Feb 5, 2021
jonatack
commented at 4:58 pm on March 12, 2021:
member
Code review ACK, needs rebase.
MarcoFalke force-pushed
on Jun 23, 2021
DrahtBot removed the label
Needs rebase
on Jun 23, 2021
MarcoFalke force-pushed
on Jun 23, 2021
MarcoFalke force-pushed
on Jun 23, 2021
MarcoFalke force-pushed
on Jun 23, 2021
MarcoFalke
commented at 7:30 am on June 23, 2021:
member
Rebased. Should be trivial to re-ACK, as most conflicts were in the scripted diff.
DrahtBot added the label
Needs rebase
on Jun 24, 2021
MarcoFalke force-pushed
on Jun 24, 2021
DrahtBot removed the label
Needs rebase
on Jun 24, 2021
MarcoFalke force-pushed
on Jul 7, 2021
MarcoFalke force-pushed
on Jul 14, 2021
MarcoFalke force-pushed
on Jul 21, 2021
DrahtBot added the label
Needs rebase
on Jul 22, 2021
MarcoFalke force-pushed
on Jul 23, 2021
DrahtBot removed the label
Needs rebase
on Jul 23, 2021
jnewbery
commented at 2:00 pm on July 23, 2021:
member
Concept ACK
jnewbery
commented at 12:40 pm on July 26, 2021:
member
What do you think about adding a generate() method to TestFramework that takes the index of the node that you want to generate on? It seems strange to pass a TestFramework function to the constructor of the TestNode.
MarcoFalke
commented at 1:01 pm on July 26, 2021:
member
That would require changing all calls to generate* and also disable TestNode::generate* to avoid races creeping in by accident. Happy to do that refactor if reviewers think it is worth it. I am mostly interested in the functional changes here.
jnewbery
commented at 3:39 pm on July 26, 2021:
member
Happy to do that refactor if reviewers think it is worth it.
I think it’s worth it, to avoid adding an implicit dependency from TestNode onto TestFramework.
MarcoFalke
commented at 9:32 am on July 28, 2021:
member
Done in #22567. (Different pr, because the discussion here wasn’t substantial, mostly GitHubs own spam, and I wanted to keep this version in case someone decides against #22567).
DrahtBot added the label
Needs rebase
on Jul 28, 2021
test: Pass default_sync_fun to TestNode constructorfa891ebded
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-12-18 12:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me