#1093397 nheko: SEGV on startup mdb.c:2156: Assertion 'rc == 0' failed in mdb_page_dirty()

Package:
nheko
Source:
nheko
Description:
desktop IM client for the Matrix protocol
Submitter:
Russell Coker
Date:
2025-02-08 11:12:05 UTC
Severity:
normal
#1093397#5
Date:
2025-01-18 03:40:44 UTC
From:
To:
On startup it hangs and then crashes, the below is the backtrace and the output.

       Storage: /var/lib/systemd/coredump/core.nheko.1000.863bb36b271346ac96a6fe4ac62501a5.3330.1737169497000>
  Size on Disk: 177.1M
       Message: Process 3330 (nheko) of user 1000 dumped core.

                Module libblkid.so.1 from deb util-linux-2.40.4-1.amd64
                Module libudev.so.1 from deb systemd-257.2-2.amd64
                Module libmount.so.1 from deb util-linux-2.40.4-1.amd64
                Module libgomp.so.1 from deb gcc-14-14.2.0-14.amd64
                Module libsystemd.so.0 from deb systemd-257.2-2.amd64
                Module libatomic.so.1 from deb gcc-14-14.2.0-14.amd64
                Module libzstd.so.1 from deb libzstd-1.5.6+dfsg-2.amd64
                Module libgcc_s.so.1 from deb gcc-14-14.2.0-14.amd64
                Module libstdc++.so.6 from deb gcc-14-14.2.0-14.amd64
                Stack trace of thread 3330:
                #0  0x00007fa48609dd8c __pthread_kill_implementation (libc.so.6 + 0x93d8c)
                #1  0x00007fa486049d02 __GI_raise (libc.so.6 + 0x3fd02)
                #2  0x00007fa4860324f0 __GI_abort (libc.so.6 + 0x284f0)
                #3  0x00007fa488dece45 n/a (liblmdb.so.0 + 0x3e45)
                #4  0x00007fa488decea2 n/a (liblmdb.so.0 + 0x3ea2)
                #5  0x00007fa488df1e25 n/a (liblmdb.so.0 + 0x8e25)
                #6  0x00007fa488df3f4b n/a (liblmdb.so.0 + 0xaf4b)
                #7  0x00007fa488df7811 mdb_cursor_put (liblmdb.so.0 + 0xe811)
                #8  0x00007fa488df9031 mdb_txn_commit (liblmdb.so.0 + 0x10031)
                #9  0x0000555fbe5d7c93 n/a (n/a + 0x0)
                ELF object binary architecture: AMD x86-64

[2025-01-18 14:04:55.730] [ui] [info] Restoring window size 1896x1123
[2025-01-18 14:04:55.744] [ui] [info] WebRTC: initialised GStreamer 1.24.11
[2025-01-18 14:04:56.116] [ui] [error] Missing GStreamer elements: glsinkbin glupload qml6glsink pipewiresrc
[2025-01-18 14:04:56.117] [ui] [info] jdenticon plugin not found.
[2025-01-18 14:04:56.118] [ui] [info] Initialized D-Bus
[2025-01-18 14:04:56.476] [ui] [info] starting nheko 0.12.0
[2025-01-18 14:04:56.480] [ui] [info] User already signed in, showing chat page
[2025-01-18 14:04:56.526] [ui] [info] Switching to chat page
[2025-01-18 14:04:56.656] [qml] [warning] qrc:/resources/qml/TopBar.qml:162:13: QML AbstractButton: Binding loop detected for property "implicitHeight" (qrc:/resources/qml/TopBar.qml:162, )
[2025-01-18 14:04:56.713] [ui] [info] Unity service available: true
[2025-01-18 14:04:56.719] [qml] [warning] Sonnet: No speller backends available! (:0, )
[2025-01-18 14:04:56.843] [db] [info] database ready
[2025-01-18 14:04:56.843] [db] [info] restoring state from cache
[2025-01-18 14:04:56.894] [db] [info] Removing old cached messages
[2025-01-18 14:04:57.257] [db] [info] Message removal done
[2025-01-18 14:04:57.289] [db] [info] Restored 79 rooms from cache
[2025-01-18 14:04:57.406] [crypto] [info] ed25519   : yvRJ+oHDnXuUQY6LIRK2+KyomhCqr/iIID05auIbD4c
[2025-01-18 14:04:57.406] [crypto] [info] curve25519: nZ0M/9U0YxAeq7NvBO+eyJk8hfiP6mJxSTUvHm+E/BI
mdb.c:2156: Assertion 'rc == 0' failed in mdb_page_dirty()
Error: signal 6:
nheko(_Z17stacktraceHandleri+0x36) [0x555fbe721ba6]
/lib/x86_64-linux-gnu/libc.so.6(+0x3fda0) [0x7fa486049da0]
/lib/x86_64-linux-gnu/libc.so.6(+0x93d8c) [0x7fa48609dd8c]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x12) [0x7fa486049d02]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3) [0x7fa4860324f0]
/lib/x86_64-linux-gnu/liblmdb.so.0(+0x3e45) [0x7fa488dece45]
/lib/x86_64-linux-gnu/liblmdb.so.0(+0x3ea2) [0x7fa488decea2]
/lib/x86_64-linux-gnu/liblmdb.so.0(+0x8e25) [0x7fa488df1e25]
/lib/x86_64-linux-gnu/liblmdb.so.0(+0xaf4b) [0x7fa488df3f4b]
/lib/x86_64-linux-gnu/liblmdb.so.0(mdb_cursor_put+0xb21) [0x7fa488df7811]
/lib/x86_64-linux-gnu/liblmdb.so.0(mdb_txn_commit+0x851) [0x7fa488df9031]
nheko(_ZN5Cache21markUserKeysOutOfDateERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE+0xb3) [0x555fbe5d7c93]
nheko(+0x7a3c33) [0x555fbe57bc33]
/lib/x86_64-linux-gnu/libQt6Core.so.6(+0x1d5aef) [0x7fa4869d5aef]
nheko(_ZN8ChatPage18loadStateFromCacheEv+0x407) [0x555fbe63ab27]
nheko(+0x862f03) [0x555fbe63af03]
/lib/x86_64-linux-gnu/libQt6Core.so.6(+0x1d5aef) [0x7fa4869d5aef]
nheko(_ZN5Cache20loadSecretsFromStoreESt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbESaIS8_EESt8functionIFvRKS7_bSD_EEb+0x7ee) [0x555fbe5ad53e]
nheko(+0x7d7b72) [0x555fbe5afb72]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN7QObject5eventEP6QEvent+0x24b) [0x7fa4869c7fdb]
/lib/x86_64-linux-gnu/libQt6Widgets.so.6(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x92) [0x7fa4887b20a2]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent+0x188) [0x7fa486987928]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x237) [0x7fa486987bb7]
/lib/x86_64-linux-gnu/libQt6Core.so.6(+0x38e897) [0x7fa486b8e897]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x5a81f) [0x7fa4865af81f]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x5ca57) [0x7fa4865b1a57]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x30) [0x7fa4865b21c0]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x73) [0x7fa486b8c473]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x2bb) [0x7fa486992adb]
/lib/x86_64-linux-gnu/libQt6Core.so.6(_ZN16QCoreApplication4execEv+0x98) [0x7fa48698a908]
nheko(main+0x18c8) [0x555fbe3564a8]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d68) [0x7fa486033d68]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7fa486033e25]
nheko(_start+0x21) [0x555fbe359551]

#1093397#10
Date:
2025-02-08 11:09:15 UTC
From:
To:
I installed the lmdb-utils package and ran:

mv ~/.local/share/nheko/nheko/db-$NAME ~/.local/share/nheko/nheko/db-$NAME.old

mkdir ~/.local/share/nheko/nheko/db-$NAME

lmdb_copy -c $BACKUP/.local/share/nheko/nheko/db-$NAME \
 ~/.local/share/nheko/nheko/db-$NAME

Then I ran nheko and it worked.

https://github.com/bmatsuo/lmdb-go/issues/131
https://github.com/pantsbuild/pants/issues/18726

This is a known issue with lmdb, this seems to be clearly a bug in the lmdb
library as corrupted data should be expected on occasion and not lead to a
SEGV.  It's OK for a library to abort a load because of corrupted data and
it's OK for an application to abort because the data couldn't be loaded.  But
it's not OK to SEGV.

Could Nheko handle this without a SEGV?

If you decide to just reassign this but to liblmdb0 then that would be
acceptable to me.  If you decide to create a new bug report about liblmdb0 and
leave this bug for the nheko reaction to it then that would be acceptable too.