Skip to content

Conversation

@furszy
Copy link
Member

@furszy furszy commented Jul 7, 2023

Coming from #28036 (comment), I thought that we were going to fix it there but seems that got merged without it for some reason.

As index sync failures trigger a shutdown request without notifying BaseIndex::BlockUntilSyncedToCurrentChain in any way, we also need to check whether a shutdown was requested or not inside 'IndexWaitSynced'.

Otherwise, any error inside the index sync process will hang the test forever.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 7, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK jamesob, MarcoFalke, ryanofsky

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@furszy furszy force-pushed the 2023_test_fix_infinite_loop branch from 98fa44c to 4b40531 Compare July 7, 2023 14:03
@maflcko
Copy link
Member

maflcko commented Jul 7, 2023

Nice, thank you.

lgtm ACK 4b405318d4c476351cccc30588f9126edd94cc35

@maflcko
Copy link
Member

maflcko commented Jul 8, 2023

Can be tested on current master with:

diff --git a/src/index/base.cpp b/src/index/base.cpp
index cf07cae286..2987eeb97b 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -234,6 +234,7 @@ void BaseIndex::ThreadSync()
                            __func__, pindex->GetBlockHash().ToString());
                 return;
             }
+            return FatalErrorf("foobar");
         }
     }
 

Result on master:

$ ./src/test/test_bitcoin -t blockfilter_index_tests 
Running 2 test cases...
Error: A fatal internal error occurred, see debug.log for details


...


Never finishes ...
...
^C

Result with this pull applied, immediate crash:

$ ./src/test/test_bitcoin -t blockfilter_index_tests 
Running 2 test cases...
Error: A fatal internal error occurred, see debug.log for details
test/util/index.cpp:18 IndexWaitSynced: Assertion `!ShutdownRequested()' failed.
unknown location(0): fatal error: in "blockfilter_index_tests/blockfilter_index_initial_sync": signal: SIGABRT (application abort requested)
test/blockfilter_index_tests.cpp(142): last checkpoint
test_bitcoin: common/args.cpp:577: void ArgsManager::AddArg(const std::string &, const std::string &, unsigned int, const OptionsCategory &): Assertion `ret.second' failed.
unknown location(0): fatal error: in "blockfilter_index_tests/blockfilter_index_init_destroy": signal: SIGABRT (application abort requested)
test/blockfilter_index_tests.cpp(272): last checkpoint: "blockfilter_index_init_destroy" fixture ctor

*** 2 failures are detected in the test module "Bitcoin Core Test Suite"
test_bitcoin: checkqueue.h:198: CCheckQueue<CScriptCheck>::~CCheckQueue() [T = CScriptCheck]: Assertion `m_worker_threads.empty()' failed.
Aborted (core dumped)

@maflcko maflcko added this to the 26.0 milestone Jul 8, 2023
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 4b405318d4c476351cccc30588f9126edd94cc35

As index sync failures trigger a shutdown request without notifying
BaseIndex::BlockUntilSyncedToCurrentChain in any way, we also need
to check whether a shutdown was requested or not inside 'IndexWaitSynced'.

Otherwise, any error inside the index sync process will hang the test
forever.
@furszy furszy force-pushed the 2023_test_fix_infinite_loop branch from 4b40531 to 89ba890 Compare July 10, 2023 18:27
@furszy
Copy link
Member Author

furszy commented Jul 10, 2023

Updated comment per feedback. Thanks ryanofsky.

Copy link
Contributor

@jamesob jamesob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 89ba890

Built/tested locally. Seems like a commonsense way to assert-fail instead of causing an infinite loop on CI machines.

@DrahtBot DrahtBot requested review from maflcko and ryanofsky July 11, 2023 16:05
@maflcko
Copy link
Member

maflcko commented Jul 11, 2023

lgtm ACK 89ba890

@DrahtBot DrahtBot removed the request for review from maflcko July 11, 2023 16:09
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 89ba890. Just comment update since last review

@ryanofsky ryanofsky merged commit 99b3af7 into bitcoin:master Jul 11, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 12, 2023
89ba890 test: indexes, fix on error infinite loop (furszy)

Pull request description:

  Coming from bitcoin#28036 (comment), I thought that we were going to fix it there but seems that got merged without it for some reason.

  As index sync failures trigger a shutdown request without notifying `BaseIndex::BlockUntilSyncedToCurrentChain` in any way, we also need to check whether a shutdown was requested or not inside 'IndexWaitSynced'.

  Otherwise, any error inside the index sync process will hang the test forever.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 89ba890
  jamesob:
    ACK 89ba890
  ryanofsky:
    Code review ACK 89ba890. Just comment update since last review

Tree-SHA512: 1f6daf34e51d3fbc802799bfa4ac0ef0d8f774db5f9e2f5d35df18a77679778475c94efc3da1fb723ebaf3583e4075e4a5cbe4a5104ad0c50e2b32076e247b29
@furszy furszy deleted the 2023_test_fix_infinite_loop branch July 20, 2023 23:00
@bitcoin bitcoin locked and limited conversation to collaborators Jul 19, 2024
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.

5 participants