qxmpp-project / qxmpp

Cross-platform C++ XMPP client and server library
411 stars 197 forks source link

[1.5] Tests hang when building with Qt6 #569

Closed krop closed 8 months ago

krop commented 1 year ago

A couple tests hang indefinitely when building qxmpp with Qt6. CMake log:

# cmake .. -DBUILD_SHARED=ON -DBUILD_TESTS=ON -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=debug
-- The C compiler identification is Clang 16.0.1
-- The CXX compiler identification is Clang 16.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Choosing Qt 6
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Found OpenGL: /usr/lib64/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Found XKB: /usr/lib64/libxkbcommon.so (found suitable version "1.5.0", minimum required is "0.5.0") 
-- Found WrapVulkanHeaders: /usr/include  
-- Configuring done (1.2s)
-- Generating done (0.1s)

The following tests hang:

Attaching gdb to one of them gives (the backtrace is the same for all hanging ones):

#12 0x00007f08c129f267 in malloc_printerr (str=str@entry=0x7f08c13b3250 "malloc_consolidate(): unaligned fastbin chunk detected") at malloc.c:5651
#13 0x00007f08c129fe8c in malloc_consolidate (av=av@entry=0x7f08c13eac80 <main_arena>) at malloc.c:4736
#14 0x00007f08c12a2508 in _int_malloc (av=av@entry=0x7f08c13eac80 <main_arena>, bytes=bytes@entry=1040) at malloc.c:3951
#15 0x00007f08c12a380d in __GI___libc_malloc (bytes=1040) at malloc.c:3305
#16 0x00007f08c14bc9ac in operator new (sz=1040) at ../../../../libstdc++-v3/libsupc++/new_op.cc:50
#17 0x00007f08c1f827c4 in QSslSocket::QSslSocket(QObject*) () from /lib64/libQt6Network.so.6
#18 0x00007f08c270a175 in QXmppOutgoingClient::QXmppOutgoingClient (this=0x55b596b2cc40, parent=0x7ffcdf011690) at /data/misc/qxmpp/src/client/QXmppOutgoingClient.cpp:174
#19 0x00007f08c269c621 in QXmppClient::QXmppClient (this=0x7ffcdf011690, parent=0x0) at /data/misc/qxmpp/src/client/QXmppClient.cpp:196
#20 0x000055b595104ce8 in TestClient::TestClient (this=0x7ffcdf011690, enableDebug=false) at tst_qxmppdiscoverymanager_autogen/EWIEGA46WW/../../../../tests/TestClient.h:20
#21 0x000055b59510904f in tst_QXmppDiscoveryManager::testItems (this=0x7ffcdf011f10) at /data/misc/qxmpp/tests/qxmppdiscoverymanager/tst_qxmppdiscoverymanager.cpp:43
#22 0x000055b595109da4 in tst_QXmppDiscoveryManager::qt_static_metacall (_o=0x7ffcdf011f10, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7ffcdf0119f0)
    at tst_qxmppdiscoverymanager_autogen/include/tst_qxmppdiscoverymanager.moc:127
#23 0x00007f08c1974485 in QMetaMethodInvoker::invokeImpl(QMetaMethod, void*, Qt::ConnectionType, long long, void const* const*, char const* const*, QtPrivate::QMetaTypeInterface const* const*) ()
   from /lib64/libQt6Core.so.6
#24 0x00007f08c1975352 in QMetaMethod::invokeImpl(QMetaMethod, void*, Qt::ConnectionType, long long, void const* const*, char const* const*, QtPrivate::QMetaTypeInterface const* const*) ()
   from /lib64/libQt6Core.so.6
#25 0x00007f08c2a92a78 in ?? () from /lib64/libQt6Test.so.6
#26 0x00007f08c2a9d25a in QTest::qRun() () from /lib64/libQt6Test.so.6
#27 0x00007f08c2a95b7b in QTest::qExec(QObject*, int, char**) () from /lib64/libQt6Test.so.6
#28 0x000055b595109ccb in main (argc=1, argv=0x7ffcdf012068) at /data/misc/qxmpp/tests/qxmppdiscoverymanager/tst_qxmppdiscoverymanager.cpp:84

The tests also fail when building with gcc and the Qt5-based tests pass.

When running the test manually:

# MALLOC_CHECK=2 ./tests/tst_qxmppdiscoverymanager
********* Start testing of tst_QXmppDiscoveryManager *********
Config: Using QtTest library 6.5.0, Qt 6.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924]), opensuse-tumbleweed 20230422
PASS   : tst_QXmppDiscoveryManager::initTestCase()
PASS   : tst_QXmppDiscoveryManager::testInfo()
malloc_consolidate(): unaligned fastbin chunk detected
Received signal 6 (SIGABRT)
         testItems function time: 0ms, total time: 4ms
lnjX commented 8 months ago

Fixed by https://github.com/qxmpp-project/qxmpp/commit/e62816aed09ea65a6a8123923eedc9429b276b4b. :)