[Interest] TSAN findings in a simple QApplication/QMetaObject::invokeMethod example

Dennis Luehring dl.soluz at gmx.net
Thu Nov 3 11:21:05 CET 2022


im usually testing all my projects with ASAN and TSAN - all the non-Qt
unit tests are clean
ASAN is near to silent with my Qt tests but TSAN is giving a lot of warnings

do i need to build Qt from source (and maybe also GLib) with TSAN support
or are there real problems in my code that i overlook

i've reduced my original much bigger unit test down to a simple app with
a thread that tunnels a signal using QMetaObject::invokeMethod over the
application thread

my system is a up-to-date Fedora 36 running freshly installed inside a VM

Fedora default gcc (GCC) 12.2.1 20220819 (Red Hat 12.2.1-2)
Fedora default Qt: Qt 5.15.6
Fedora default cmake version 3.22.2

im interested in understanding whats maybe wrong with
My_application::post_command(char const*) - see the warning about this
method in the TSAN log

thanks for any help or tips






all my project files on pastebin: https://pastebin.com/qFrMyhr4

[main.cpp]
#include "my_application.h"

#include <thread>

int main( int argc, char* argv[] )
{
   printf( "QT_VERSION_STR: %s\n", QT_VERSION_STR );

   My_application app( argc, argv );

   QObject::connect( &app, &My_application::on_command, [&]( const char*
buffer_ ) {
     printf("My_application::on_command: %s\n", buffer_);
   } );

#if 1
   auto my_thread_proc = [&app](){
     for(int i = 0; i < 100; ++i)
     {
       app.post_command("some_command");
     }
   };
   auto my_thread1 = std::thread(my_thread_proc);
#endif

   QWidget window;
   window.resize( 320, 240 );
   window.show();

   int result = app.exec();

   printf("---> after app.exec()\n");

   return result;
}

-----------

[my_application.h]
#pragma once

#include <QtWidgets>

class My_application : public QApplication
{
     Q_OBJECT
public:
     explicit My_application( int& argc, char** argv );
     void post_command( const char* buffer_ );
     Q_SIGNAL void on_command( const char* buffer_ );
};

-----------

[my_application.cpp]
#include "my_application.h"

My_application::My_application( int& argc, char** argv ) : QApplication(
argc, argv ){}

void My_application::post_command( const char* buffer_ )
{
   QMetaObject::invokeMethod(
     this, [this, buffer_] { Q_EMIT on_command( buffer_ ); },
Qt::QueuedConnection );
}

-----------

[CMakeLists.txt]
cmake_minimum_required (VERSION 3.14)

project(qt_tsan_tests)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

add_executable (qt_tsan_tests my_application.h my_application.cpp main.cpp)

find_package(Qt5 CONFIG COMPONENTS Widgets REQUIRED) # using Fedora36
default Qt 5.15.6

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer -Wall
-Wextra -fsanitize=thread" )
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
-fno-omit-frame-pointer -fsanitize=thread")

target_link_libraries(qt_tsan_tests PRIVATE Qt5::Widgets)
----------

running this program with

./qt_tsan_tests > out.txt 2>&1

gives following warnings (https://pastebin.com/WTfke5jq)

==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Read of size 8 at 0x7b0c00002178 by thread T1:
     #0 memcpy <null> (libtsan.so.2+0x5e806)
     #1 QVector<QPostEvent>::realloc(int,
QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0x2af42c)

   Previous write of size 8 at 0x7b0c00002178 by main thread:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Location is heap block of size 48 at 0x7b0c00002160 allocated by main
thread:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5e806) in memcpy
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0c00002160 by thread T1:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 QVector<QPostEvent>::realloc(int,
QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0x2af412)

   Previous write of size 8 at 0x7b0c00002160 by main thread:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Atomic read of size 1 at 0x7b0c000031b0 by main thread:
     #0 pthread_mutex_lock <null> (libtsan.so.2+0x56341)
     #1 dbus_message_new_empty_header <null> (libdbus-1.so.3+0x26fe6)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Previous write of size 8 at 0x7b0c000031b0 by thread T1 (mutexes:
write M131):
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 _dbus_platform_rmutex_new <null> (libdbus-1.so.3+0x382b7)

   Location is heap block of size 40 at 0x7b0c000031b0 allocated by
thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 _dbus_platform_rmutex_new <null> (libdbus-1.so.3+0x382b7)

   Mutex M131 (0x7ff536dff220) created at:
     #0 pthread_mutex_lock <null> (libtsan.so.2+0x56341)
     #1 dbus_threads_init <null> (libdbus-1.so.3+0x2c93c)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x56341) in
__interceptor_pthread_mutex_lock
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b1c00000000 by thread T1:
     #0 operator delete(void*, unsigned long) <null> (libtsan.so.2+0x8769d)
     #1 QCoreApplicationPrivate::sendPostedEvents(QObject*, int,
QThreadData*) <null> (libQt5Core.so.5+0x2ab53d)

   Previous write of size 8 at 0x7b1c00000000 by main thread:
     #0 operator new(unsigned long) <null> (libtsan.so.2+0x87d83)
     #1 void doActivate<false>(QObject*, int, void**) <null>
(libQt5Core.so.5+0x2dba46)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x8769d) in
operator delete(void*, unsigned long)
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Atomic read of size 1 at 0x7b0c00003f90 by main thread:
     #0 pthread_mutex_lock <null> (libtsan.so.2+0x56341)
     #1 dbus_connection_get_is_connected <null> (libdbus-1.so.3+0x15cea)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Previous write of size 8 at 0x7b0c00003f90 by thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 _dbus_platform_rmutex_new <null> (libdbus-1.so.3+0x382b7)

   Location is heap block of size 40 at 0x7b0c00003f90 allocated by
thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 _dbus_platform_rmutex_new <null> (libdbus-1.so.3+0x382b7)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x56341) in
__interceptor_pthread_mutex_lock
==================
QSocketNotifier: Can only be used with threads started with QThread
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b7000050c90 by thread T5:
     #0 memset <null> (libtsan.so.2+0x5d624)
     #1 g_slice_alloc0 <null> (libglib-2.0.so.0+0x74be1)

   Previous write of size 8 at 0x7b7000050c90 by thread T6:
     #0 posix_memalign <null> (libtsan.so.2+0x3f988)
     #1 slab_allocator_alloc_chunk <null> (libglib-2.0.so.0+0x718a3)

   Location is heap block of size 2032 at 0x7b7000050800 allocated by
thread T6:
     #0 posix_memalign <null> (libtsan.so.2+0x3f988)
     #1 slab_allocator_alloc_chunk <null> (libglib-2.0.so.0+0x718a3)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5d624) in
__interceptor_memset
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Atomic read of size 1 at 0x7b0c000059d0 by thread T5:
     #0 pthread_mutex_lock <null> (libtsan.so.2+0x56341)
     #1 g_variant_type_info_get <null> (libglib-2.0.so.0+0xa0de9)

   Previous write of size 8 at 0x7b0c000059d0 by main thread:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_rec_mutex_impl_new <null> (libglib-2.0.so.0+0xa51df)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Location is heap block of size 40 at 0x7b0c000059d0 allocated by main
thread:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_rec_mutex_impl_new <null> (libglib-2.0.so.0+0xa51df)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x56341) in
__interceptor_pthread_mutex_lock
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0800008660 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 8 at 0x7b0800008660 by thread T5:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b6000060680 by main thread:
     #0 memset <null> (libtsan.so.2+0x5d624)
     #1 g_slice_alloc0 <null> (libglib-2.0.so.0+0x74be1)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Previous write of size 8 at 0x7b6000060680 by thread T7:
     #0 posix_memalign <null> (libtsan.so.2+0x3f988)
     #1 slab_allocator_alloc_chunk <null> (libglib-2.0.so.0+0x718a3)

   Location is heap block of size 1008 at 0x7b6000060400 allocated by
thread T7:
     #0 posix_memalign <null> (libtsan.so.2+0x3f988)
     #1 slab_allocator_alloc_chunk <null> (libglib-2.0.so.0+0x718a3)

   Thread T7 'dconf worker' (tid=5891, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5d624) in
__interceptor_memset
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b1c00013f60 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 8 at 0x7b1c00013f60 by thread T5:
     #0 calloc <null> (libtsan.so.2+0x3f8b0)
     #1 g_malloc0 <null> (libglib-2.0.so.0+0x5a3a0)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b100000a480 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous read of size 8 at 0x7b100000a480 by thread T5:
     #0 strlen <null> (libtsan.so.2+0x5c54e)
     #1 g_strdup <null> (libglib-2.0.so.0+0x6e196)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0800008600 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous read of size 8 at 0x7b0800008600 by thread T5:
     #0 memcpy <null> (libtsan.so.2+0x5e806)
     #1 g_memdup2 <null> (libglib-2.0.so.0+0x6e241)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0400003660 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 8 at 0x7b0400003660 by thread T5:
     #0 realloc <null> (libtsan.so.2+0x43a8f)
     #1 g_realloc <null> (libglib-2.0.so.0+0x5a4cf)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0400003680 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 1 at 0x7b0400003686 by thread T5:
     #0 poll <null> (libtsan.so.2+0x622fb)
     #1 g_main_context_iterate.constprop.0 <null> (libglib-2.0.so.0+0xaa23c)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7ba000000120 by thread T6:
     #0 close <null> (libtsan.so.2+0x40a8c)
     #1 g_main_context_unref <null> (libglib-2.0.so.0+0x539f6)

   Previous read of size 8 at 0x7ba000000120 by thread T5:
     #0 read <null> (libtsan.so.2+0x51979)
     #1 g_main_context_check <null> (libglib-2.0.so.0+0x555f9)

   Location is file descriptor 18 created by thread T5 at:
     #0 eventfd <null> (libtsan.so.2+0x41d33)
     #1 g_wakeup_new <null> (libglib-2.0.so.0+0xa366a)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T5 'pool-qt_tsan_te' (tid=5889, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x40a8c) in
__interceptor_close
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b6000005e80 by thread T7:
     #0 memset <null> (libtsan.so.2+0x5d624)
     #1 g_slice_alloc0 <null> (libglib-2.0.so.0+0x74be1)

   Previous write of size 8 at 0x7b6000005e80 by main thread:
     [failed to restore the stack]

   Location is heap block of size 1008 at 0x7b6000005c00 allocated by
main thread:
     #0 posix_memalign <null> (libtsan.so.2+0x3f988)
     #1 slab_allocator_alloc_chunk <null> (libglib-2.0.so.0+0x718a3)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T7 'dconf worker' (tid=5891, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5d624) in
__interceptor_memset
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Read of size 1 at 0x7b0400005030 by thread T6:
     #0 strcmp <null> (libtsan.so.2+0x63728)
     #1 g_str_equal <null> (libglib-2.0.so.0+0x38a7c)

   Previous write of size 8 at 0x7b0400005030 by thread T7:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)

   Location is heap block of size 1 at 0x7b0400005030 allocated by
thread T7:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T7 'dconf worker' (tid=5891, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x63728) in
__interceptor_strcmp
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Read of size 1 at 0x7b080000b000 by thread T6:
     #0 strcmp <null> (libtsan.so.2+0x63728)
     #1 <null> <null> (libgio-2.0.so.0+0x10902b)

   Previous write of size 8 at 0x7b080000b000 by thread T7:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)

   Location is heap block of size 22 at 0x7b080000b000 allocated by
thread T7:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

   Thread T7 'dconf worker' (tid=5891, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x63728) in
__interceptor_strcmp
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b0800014020 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 8 at 0x7b0800014020 by main thread (mutexes:
write M354):
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 g_malloc <null> (libglib-2.0.so.0+0x5a278)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Mutex M354 (0x7b0c00006030) created at:
     #0 pthread_mutex_init <null> (libtsan.so.2+0x50ec8)
     #1 g_rec_mutex_impl_new <null> (libglib-2.0.so.0+0xa520c)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b1c00011f70 by thread T6:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 g_free <null> (libglib-2.0.so.0+0x56b8c)

   Previous write of size 8 at 0x7b1c00011f70 by main thread (mutexes:
write M354):
     #0 calloc <null> (libtsan.so.2+0x3f8b0)
     #1 g_malloc0 <null> (libglib-2.0.so.0+0x5a3a0)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Mutex M354 (0x7b0c00006030) created at:
     #0 pthread_mutex_init <null> (libtsan.so.2+0x50ec8)
     #1 g_rec_mutex_impl_new <null> (libglib-2.0.so.0+0xa520c)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

   Thread T6 'gdbus' (tid=5890, running) created by thread T5 at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 g_thread_new_internal <null> (libglib-2.0.so.0+0x80d70)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Read of size 8 at 0x7b3c00007db8 by thread T8:
     #0 memcpy <null> (libtsan.so.2+0x5e806)
     #1 QVector<QPostEvent>::realloc(int,
QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0x2af42c)
     #2 My_application::post_command(char const*)
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/my_application.cpp:9
(qt_tsan_tests+0x402916)
     #3 operator()
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:19
(qt_tsan_tests+0x402e62)
     #4 __invoke_impl<void, main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:61 (qt_tsan_tests+0x403850)
     #5 __invoke<main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:96 (qt_tsan_tests+0x4037bd)
     #6 _M_invoke<0> /usr/include/c++/12/bits/std_thread.h:252
(qt_tsan_tests+0x403722)
     #7 operator() /usr/include/c++/12/bits/std_thread.h:259
(qt_tsan_tests+0x4036cc)
     #8 _M_run /usr/include/c++/12/bits/std_thread.h:210
(qt_tsan_tests+0x403686)
     #9 execute_native_thread_routine <null> (libstdc++.so.6+0xdbb02)

   Previous write of size 8 at 0x7b3c00007db8 by thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)

   Location is heap block of size 240 at 0x7b3c00007da0 allocated by
thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)

   Thread T8 (tid=5893, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1
std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) <null>
(libstdc++.so.6+0xdbbd8)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:22
(qt_tsan_tests+0x402f46)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5e806) in memcpy
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b3c00007da0 by thread T8:
     #0 free <null> (libtsan.so.2+0x488e2)
     #1 QVector<QPostEvent>::realloc(int,
QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0x2af412)
     #2 My_application::post_command(char const*)
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/my_application.cpp:9
(qt_tsan_tests+0x402916)
     #3 operator()
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:19
(qt_tsan_tests+0x402e62)
     #4 __invoke_impl<void, main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:61 (qt_tsan_tests+0x403850)
     #5 __invoke<main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:96 (qt_tsan_tests+0x4037bd)
     #6 _M_invoke<0> /usr/include/c++/12/bits/std_thread.h:252
(qt_tsan_tests+0x403722)
     #7 operator() /usr/include/c++/12/bits/std_thread.h:259
(qt_tsan_tests+0x4036cc)
     #8 _M_run /usr/include/c++/12/bits/std_thread.h:210
(qt_tsan_tests+0x403686)
     #9 execute_native_thread_routine <null> (libstdc++.so.6+0xdbb02)

   Previous write of size 8 at 0x7b3c00007da0 by thread T1:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)

   Thread T8 (tid=5893, running) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1
std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) <null>
(libstdc++.so.6+0xdbbd8)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:22
(qt_tsan_tests+0x402f46)

   Thread T1 'QDBusConnection' (tid=5884, running) created by main
thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe7f6d)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:9
(qt_tsan_tests+0x402eed)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x488e2) in
__interceptor_free
==================
==================
WARNING: ThreadSanitizer: data race (pid=5882)
   Write of size 8 at 0x7b8000050a38 by main thread:
     #0 memmove <null> (libtsan.so.2+0x5e6d6)
     #1 QPostEventList::addEvent(QPostEvent const&) [clone .part.0]
<null> (libQt5Core.so.5+0x2aa7d9)
     #2 __libc_start_call_main <null> (libc.so.6+0x2950f)

   Previous write of size 8 at 0x7b8000050a38 by thread T8:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)
     #2 My_application::post_command(char const*)
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/my_application.cpp:9
(qt_tsan_tests+0x402916)
     #3 operator()
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:19
(qt_tsan_tests+0x402e62)
     #4 __invoke_impl<void, main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:61 (qt_tsan_tests+0x403850)
     #5 __invoke<main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:96 (qt_tsan_tests+0x4037bd)
     #6 _M_invoke<0> /usr/include/c++/12/bits/std_thread.h:252
(qt_tsan_tests+0x403722)
     #7 operator() /usr/include/c++/12/bits/std_thread.h:259
(qt_tsan_tests+0x4036cc)
     #8 _M_run /usr/include/c++/12/bits/std_thread.h:210
(qt_tsan_tests+0x403686)
     #9 execute_native_thread_routine <null> (libstdc++.so.6+0xdbb02)

   Location is heap block of size 4080 at 0x7b8000050000 allocated by
thread T8:
     #0 malloc <null> (libtsan.so.2+0x3f618)
     #1 QArrayData::allocate(unsigned long, unsigned long, unsigned
long, QFlags<QArrayData::AllocationOption>) <null> (libQt5Core.so.5+0xf34f1)
     #2 My_application::post_command(char const*)
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/my_application.cpp:9
(qt_tsan_tests+0x402916)
     #3 operator()
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:19
(qt_tsan_tests+0x402e62)
     #4 __invoke_impl<void, main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:61 (qt_tsan_tests+0x403850)
     #5 __invoke<main(int, char**)::<lambda()> >
/usr/include/c++/12/bits/invoke.h:96 (qt_tsan_tests+0x4037bd)
     #6 _M_invoke<0> /usr/include/c++/12/bits/std_thread.h:252
(qt_tsan_tests+0x403722)
     #7 operator() /usr/include/c++/12/bits/std_thread.h:259
(qt_tsan_tests+0x4036cc)
     #8 _M_run /usr/include/c++/12/bits/std_thread.h:210
(qt_tsan_tests+0x403686)
     #9 execute_native_thread_routine <null> (libstdc++.so.6+0xdbb02)

   Thread T8 (tid=5893, finished) created by main thread at:
     #0 pthread_create <null> (libtsan.so.2+0x5f0e6)
     #1
std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) <null>
(libstdc++.so.6+0xdbbd8)
     #2 main
/home/linux/dev/project/test/qt_tsan_tests_dev/qt_tsan_tests/main.cpp:22
(qt_tsan_tests+0x402f46)

SUMMARY: ThreadSanitizer: data race (/lib64/libtsan.so.2+0x5e6d6) in memmove
==================
QT_VERSION_STR: 5.15.6
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_application::on_command: some_command
My_applicationterminate called without an active exception
::on_command: some_command
---> after app.exec()



More information about the Interest mailing list