Skip to content

SegFault in QSortFilterProxyModelPrivate::build_source_to_proxy_mapping #880

@fanquake

Description

@fanquake

Moved from bitcoin/bitcoin#32957.

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

I was loading a bunch of old wallets sequentially using "bitcoin-cli loadwallet" in a loop. bitcoin-qt crashed shortly after finishing loading one wallet and starting to load the next.

The debug log shows this at the end:

2025-07-13T13:06:26Z init message: Rescanning…
2025-07-13T13:06:26Z [wallet23] Rescanning last 3130 blocks (from block 902235)...
2025-07-13T13:06:26Z [wallet23] Rescan started from block 00000000000000000001009ee18d68a681723b922e5b756aa89c513f28e15876... (fast variant using block filters)
2025-07-13T13:07:02Z [wallet23] Scanning current mempool transactions.
2025-07-13T13:07:02Z [wallet23] Rescan completed in           36695ms
2025-07-13T13:07:02Z [wallet23] setKeyPool.size() = 60000
2025-07-13T13:07:02Z [wallet23] mapWallet.size() = 303
2025-07-13T13:07:02Z [wallet23] m_address_book.size() = 16
2025-07-13T13:07:02Z Using SQLite Version 3.40.1
2025-07-13T13:07:02Z Using wallet /home/user/.bitcoin/wallets/wallet24
2025-07-13T13:07:02Z init message: Loading wallet…
2025-07-13T13:07:02Z [wallet24] Wallet file version = 10500, last client version = 280000

gdb shows this stack trace:

Thread 1 "bitcoin-qt-v29." received signal SIGSEGV, Segmentation fault.
QSortFilterProxyModelPrivate::build_source_to_proxy_mapping (proxy_to_source=..., source_to_proxy=..., this=this@entry=0x55555b826470)
    at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:61
61      ../../include/QtCore/../../src/corelib/tools/qarraydata.h: No such file or directory.

(gdb) where
#0  QSortFilterProxyModelPrivate::build_source_to_proxy_mapping (proxy_to_source=..., source_to_proxy=..., this=this@entry=0x55555b826470)
    at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:61
#1  0x00007ffff6682b97 in QSortFilterProxyModelPrivate::sort (this=0x55555b82b3e0) at itemmodels/qsortfilterproxymodel.cpp:634
#2  0x00005555557b4c54 in OverviewPage::setWalletModel (this=this@entry=0x7fff28023430, model=0x7ffb66326a30) at ./qt/overviewpage.cpp:269
#3  0x000055555577c395 in WalletView::WalletView (this=this@entry=0x55555b6ecec0, wallet_model=<optimized out>, _platformStyle=0x555556be0cf0, parent=<optimized out>)
    at ./qt/walletview.cpp:41
#4  0x00005555556ef343 in BitcoinGUI::addWallet (this=0x555556eafdc0, walletModel=<optimized out>) at ./qt/bitcoingui.cpp:739
#5  0x00005555556f478d in _ZZN7GUIUtil20ExceptionSafeConnectIP16WalletControllerMS1_FvP11WalletModelEP10BitcoinGUIMS7_FvS4_EEEDaT_T0_T1_T2_N2Qt14ConnectionTypeEENKUlDpOT_E_clIJRS4_EEEDaSJ_ (__closure=0x555556d431a0) at ./qt/guiutil.h:400
#6  _ZN9QtPrivate11FunctorCallINS_11IndexesListIJLi0EEEENS_4ListIJP11WalletModelEEEvZN7GUIUtil20ExceptionSafeConnectIP16WalletControllerMS9_FvS5_EP10BitcoinGUIMSD_FvS5_EEEDaT_T0_T1_T2_N2Qt14ConnectionTypeEEUlDpOT_E_E4callERSQ_PPv (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:146
#7  _ZN9QtPrivate7FunctorIZN7GUIUtil20ExceptionSafeConnectIP16WalletControllerMS3_FvP11WalletModelEP10BitcoinGUIMS9_FvS6_EEEDaT_T0_T1_T2_N2Qt14ConnectionTypeEEUlDpOT_E_Li1EE4callINS_4ListIJS6_EEEvEEvRSM_PvPSS_ (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:256
#8  _ZN9QtPrivate18QFunctorSlotObjectIZN7GUIUtil20ExceptionSafeConnectIP16WalletControllerMS3_FvP11WalletModelEP10BitcoinGUIMS9_FvS6_EEEDaT_T0_T1_T2_N2Qt14ConnectionTypeEEUlDpOT_E_Li1ENS_4ListIJS6_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb (which=<optimized out>, this_=0x555556d43190, r=<optimized out>, a=<optimized out>,
    ret=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:443
#9  0x00007ffff66dd730 in QObject::event (this=0x555556eafdc0, e=0x7ffb65750450) at kernel/qobject.cpp:1347
#10 0x00007ffff7962fae in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x555556eafdc0, e=0x7ffb65750450) at kernel/qapplication.cpp:3640
#11 0x00007ffff66b1738 in QCoreApplication::notifyInternal2 (receiver=0x555556eafdc0, event=0x7ffb65750450) at kernel/qcoreapplication.cpp:1064
#12 0x00007ffff66b18fe in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#13 0x00007ffff66b46c1 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x555556955090) at kernel/qcoreapplication.cpp:1821
#14 0x00007ffff66b4b48 in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at kernel/qcoreapplication.cpp:1680
#15 0x00007ffff670a193 in postEventSourceDispatch (s=0x555556a5ac20) at kernel/qeventdispatcher_glib.cpp:277
#16 0x00007ffff571e749 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff571e9d8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff571ea6c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff6709876 in QEventDispatcherGlib::processEvents (this=0x555556a0b3a0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#20 0x00007ffff66b01bb in QEventLoop::exec (this=this@entry=0x7fffffffd3b0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#21 0x00007ffff66b8316 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#22 0x00007ffff7130ecc in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#23 0x00007ffff7962f25 in QApplication::exec () at kernel/qapplication.cpp:2832
#24 0x00005555556db812 in GuiMain (argc=2, argv=0x7fffffffdb88) at ./qt/bitcoin.cpp:691

Expected behaviour

I expect to be able to load wallets without a seg fault.

Steps to reproduce

This is the only time I've seen this crash.

Relevant log output

See above.

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

29.0.0

Operating system and version

Debian GNU/Linux 12 (bookworm)

Machine specifications

Debian/Intel SSD, hotel wifi

Plenty of RAM and swap

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingWallet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions