Crash on fail ~CCheckQueue() destructor? #29930

issue asctime openend this issue on April 21, 2024
  1. asctime commented at 6:40 pm on April 21, 2024: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    This will crash the application when false:

    0    ~CCheckQueue()
    1    {
    2        assert(m_worker_threads.empty());
    3    }
    

    Expected behaviour

    Possibly do something more like this?

     0
     1    ~CCheckQueue() {   
     2        try {
     3            if (!m_worker_threads.empty()) {
     4                // Attempt to stop worker threads if they haven't been stopped yet.
     5                StopWorkerThreads();
     6            }
     7        } catch (const std::exception& e) {
     8            LogPrint(BCLog::UTIL, "Exception in ~CCheckQueue: %s\n", e.what());
     9        }
    10    }
    

    I am not very familiar with the code base. This just looked weird to me.

    Steps to reproduce

    Open settings in bitcoin-qt, adjust and save.

    Relevant log output

    Crash with:

    assertion failure in the file checkqueue.h at line 198. The assertion that failed is m_worker_threads.empty()

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    26.1

    Operating system and version

    Windows, MinGW64 (using portable_endian.h)

    Machine specifications

    No response

  2. 1440000bytes commented at 7:45 pm on April 21, 2024: none

    Open settings in bitcoin-qt, adjust and save.

    I am not able to reproduce this. What exactly did you adjust in settings before clicking on ok?

  3. asctime commented at 9:01 pm on April 21, 2024: none

    Any setting, or just clicking ok (cancel is fine). It’s probably something slightly different in MinGW pthread support. so assert(m_worker_threads.empty()); causing a crash still analyzing.

    So I understand assert will tell us what part of the code crashed, but it doesn’t really tell us anything about the worker that wont stop, (thread id etc) so far it’s only the settings box -> everything else seems to work after #29931 fingers crossed. gui syncing now.

  4. maflcko commented at 8:40 am on April 22, 2024: member
  5. maflcko commented at 8:41 am on April 22, 2024: member
    Is this still an issue with a recent version of Bitcoin Core? If yes, what are the exact steps to reproduce?
  6. maflcko closed this on Apr 22, 2024

  7. asctime commented at 11:24 pm on April 22, 2024: none
    Thanks for your very helpful response maflcko. As you indicate, the code in question was changed anyway, just didn’t see the thread. V26.1 is that latest I can compile, haven’t updated to c++20. Thanks yes close.

github-metadata-mirror

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-11-23 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me