Skip to content

test: Fix feature_init intermittent issues - #24192

Merged
maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2201-testFI
Jan 31, 2022
Merged

maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2201-testFI

Conversation

@maflcko

@maflcko maflcko commented Jan 28, 2022

Copy link
Copy Markdown
Member

The test doesn't work currently because the log might be finalized before wait_for_debug_log is started, in which case it will assume the log is empty and fail to detect any line.

Fix this by calling wait_for_debug_log first. Fixes #24060.

Also, remove the "random line number" part of the test, because it doesn't really test anything novel. wait_for_debug_log is inherently racy, so will randomly terminate at the exact point or later. So the randomization is already sufficiently covered.

@maflcko maflcko added this to the 23.0 milestone Jan 28, 2022
@DrahtBot DrahtBot added the Tests label Jan 28, 2022
@DrahtBot

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24117 (index: make indices robust against init aborts by mzumsande)
  • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
  • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
  • #10102 (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.

@luke-jr

luke-jr commented Jan 31, 2022

Copy link
Copy Markdown
Contributor

Would prefer to have the fix and test removal in separate commits, if not separate PRs.

MarcoFalke added 2 commits January 31, 2022 10:09
This is needed for the next commit.

Also, it doesn't really test anything novel. wait_for_debug_log is
inherently racy, so will randomly terminate at the exact point or later.
So the randomization is already sufficiently covered by the existing
test.
@maflcko

maflcko commented Jan 31, 2022

Copy link
Copy Markdown
Member Author

Thx, done

@mzumsande

Copy link
Copy Markdown
Contributor

Also, remove the "random line number" part of the test, because it doesn't really test anything novel. wait_for_debug_log is inherently racy, so will randomly terminate at the exact point or later. So the randomization is already sufficiently covered.

I'd imagine that the "randomly terminate at the exact point or later" from the first part is a kind of randomness with a distribution that is strongly peaked around some point after this "exact point" (depending on hardware etc.). So whether the first part really covers the kind of randomness that the second part seems to depend on many factors, among them the density of the net of predefined lines provided in the first part.

The "random line number" part contributes a more uniform randomness of lines to stop after, so it doesn't seem completely redundant to me.

@jamesob : any thoughts on this?

@maflcko

maflcko commented Jan 31, 2022

Copy link
Copy Markdown
Member Author

The test was merged two months ago and never fully worked. There are already too many intermittent CI issues and this test isn't going to make it better. In fact, how is this test supposed to catch any issues if a red CI is rerun anyway? An alternative to this pull would be to remove the test completely and merge it again once it fully works.

I do agree that is aims to provide some nice coverage, which is why I opted to fix it here instead of removing. However, I don't see why the burden should be on me to fix everything in this pull. I think the subtest can be re-introduced in a follow-up if deemed useful.

@mzumsande

Copy link
Copy Markdown
Contributor

Yes, the test is "messy" and high maintenance and has a very different approach compared to most other functional tests. On the plus side, it covers a lot of init code that is complicated and hard to test, and I think that it has a much higher potential to find bugs compared to other tests.

As for the second part that is removed in this PR: Does this also have a problem leading to intermittent failures? The CI fail from the linked issue happens in the first part.

@maflcko

maflcko commented Jan 31, 2022

Copy link
Copy Markdown
Member Author

No, I removed it because it requires a major rewrite of the test framework and test itself to be implemented. I am not going to do that here, unless someone else does it.

@jamesob

jamesob commented Jan 31, 2022

Copy link
Copy Markdown
Contributor

ACK fa7b075

I think it's a shame to remove the randomized subtest, since that may help us catch init issues that we haven't thought to cover with the pre-specified log fragments, but if it's causing more trouble than it's worth from the standpoint of the maintainers then I think some signal is better than no signal.

@maflcko

maflcko commented Jan 31, 2022

Copy link
Copy Markdown
Member Author

I think it's a shame to remove the randomized subtest

Anyone is free to add it back anytime. It is just that I don't have the time for it right now and removing it temporarily is needed to fix the bug.

@mzumsande

Copy link
Copy Markdown
Contributor

Code Review ACK fa7b075

It is just that I don't have the time for it right now and removing it temporarily is needed to fix the bug.

That makes sense, just didn't agree with the rationale in OP that the randomized part added nothing.

The issue for a possible follow-up to solve seems to be to retrieve num_total_logs, which is needed for the randomized subtest but not returned by wait_for_debug_log anymore after using a with statement / context manager.

@maflcko
maflcko merged commit 8f137e6 into bitcoin:master Jan 31, 2022
@maflcko
maflcko deleted the 2201-testFI branch January 31, 2022 17:06
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 25, 2022
Summary:
This is needed for the next commit.

Also, it doesn't really test anything novel. wait_for_debug_log is
inherently racy, so will randomly terminate at the exact point or later.
So the randomization is already sufficiently covered by the existing
test.

This is a partial backport of [[bitcoin/bitcoin#24192 | core#24192]]
bitcoin/bitcoin@fa4595d

Depends on D12617

Test Plan: `ninja check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12620
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 25, 2022
Summary:

> The test doesn't work currently because the log might be finalized before `wait_for_debug_log` is started, in which case it will assume the log is empty and fail to detect any line.
>
> Fix this by calling wait_for_debug_log first. Fixes core#24060.

This concludes backport of [[bitcoin/bitcoin#24192 | core#24192]]
bitcoin/bitcoin@fa7b075

Depends on D12620

Test Plan: `ninja check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12621
@bitcoin bitcoin locked and limited conversation to collaborators Jan 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature_init.py loadblk thread start']" does not partially match log:

5 participants