test: Fix TestFlushBehavior when coin has non-zero dynamic memory usage - #33381
test: Fix TestFlushBehavior when coin has non-zero dynamic memory usage#33381PiRK wants to merge 1 commit into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33381. ReviewsSee the guideline for information on the review process. |
e4aea00 to
32bb174
Compare
|
I force pushed to fix a use-after-move bug |
|
This change breaks the test. |
32bb174 to
21aee81
Compare
|
let's see if this works. I moved the problematic test line to its own test suite, where it does not affect other flush tests. The failure I'm trying to solve seems intermittent. It happens about 75% of the time on master if I just add the scriptPubKey to MakeCoin. |
|
To clarify the rationale for this PR: the This PR ensure that the |
| @@ -56,10 +56,9 @@ if [ -n "$PIP_PACKAGES" ]; then | |||
| fi | |||
|
|
|||
| if [[ -n "${USE_INSTRUMENTED_LIBCPP}" ]]; then | |||
| ${CI_RETRY_EXE} git clone --depth=1 https://github.com/llvm/llvm-project -b "llvmorg-21.1.1" /llvm-project | |||
There was a problem hiding this comment.
I don't understand how this related to the PR. Is this really needed here or can it be split out to a different PR?
There was a problem hiding this comment.
Not sure why this commit was pulled into my PR the last time i rebased on master. This was the top commit from master that had just been merged (#33364) at the time
Some kind of github glitch?
There was a problem hiding this comment.
… memory usage If the random coin in this test has a non-null scriptpubkey, `cache->SanityCheck();` fails an assertion because the `BOOST_CHECK_THROW` line leaves `CCoinsViewCache::cachedCoinsUsage` in a corrupted state: the erroring `AddCoin` call decrements the value to 0 even though the coin is still in the cache, then the next `SpendCoin` call decrements the value again causing a `size_t` underflow. ``` $ ./build/bin/test_bitcoin --run_test=coins_tests Running 8 test cases... test_bitcoin: ./coins.cpp:345: void CCoinsViewCache::SanityCheck() const: Assertion `recomputed_usage == cachedCoinsUsage' failed. unknown location(0): fatal error: in "coins_tests/ccoins_flush_behavior": signal: SIGABRT (application abort requested) ./test/coins_tests.cpp(987): last checkpoint test_bitcoin: ./common/args.cpp:578: void ArgsManager::AddArg(const std::string&, const std::string&, unsigned int, const OptionsCategory&): Assertion `ret.second' failed. unknown location(0): fatal error: in "coins_tests/coins_resource_is_used": signal: SIGABRT (application abort requested) ./test/coins_tests.cpp(1064): last checkpoint: "coins_resource_is_used" fixture ctor ``` Move the `BOOST_CHECK_THROW` line to its own suite so it does not corrupt the coins view for further flush tests. .
21aee81 to
c9ad7e5
Compare
|
Rebased, the phantom commit is gone now |
|
Tested with this patch: coins_tests fails as expected on the commit just before #32313 was merged And the test now passes on master. Not sure if setting the scriptPubkey in |
|
AFAICT the issue my patch raised was only reachable after suppressing a |
|
Was a good find, thanks, I agree that it doesn't make a lot of sense anymore to keep this around, if you agree, please consider closing the PR |
If the random coin in this test has a non-null scriptpubkey,
cache->SanityCheck();fails an assertion because theBOOST_CHECK_THROWline leavesCCoinsViewCache::cachedCoinsUsagein a corrupted state: the erroringAddCoincall decrements the value to 0 even though the coin is still in the cache, then the nextSpendCoincall decrements the value again causing asize_tunderflow.Move the
BOOST_CHECK_THROWtest to its own suite, so that other flush tests are not affected by the caches's inconsistent state