Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-133738

Thread sanitizer (TSAN) warns about data race with Qt DBus

    XMLWordPrintable

Details

    • Linux/Yocto

    Description

      Most uses of DBus make thread sanitizer throw warnings like these:

      ==================
      WARNING: ThreadSanitizer: data race (pid=387332)
        Write of size 8 at 0x7b0800000a00 by thread T1:
          #0 operator delete(void*) <null> (qtbug133738+0xcfabe) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QMetaCallEvent::~QMetaCallEvent() <null> (libQt6Core.so.6+0x1b58df) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
      
        Previous write of size 8 at 0x7b0800000a00 by main thread:
          #0 operator new(unsigned long) <null> (qtbug133738+0xcf426) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QDBusConnectionManager::connectToBus(QDBusConnection::BusType, QString const&, bool) <null> (libQt6DBus.so.6+0x3cc05) (BuildId: 9cae84cd992517dda1fedde60a39e6bf47e411da)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
        Thread T1 'QDBusConnection' (tid=387336, running) created by main thread at:
          #0 pthread_create <null> (qtbug133738+0x4f46d) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QThread::start(QThread::Priority) <null> (libQt6Core.so.6+0x3034a9) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
      SUMMARY: ThreadSanitizer: data race (/home/user/qtbug133738/build/tsan-Debug/qtbug133738+0xcfabe) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f) in operator delete(void*)
      ==================
      ==================
      WARNING: ThreadSanitizer: data race (pid=387332)
        Write of size 8 at 0x7b2000000400 by thread T1:
          #0 operator delete(void*) <null> (qtbug133738+0xcfabe) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) <null> (libQt6Core.so.6+0x16e76e) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
      
        Previous write of size 8 at 0x7b2000000400 by main thread:
          #0 operator new(unsigned long) <null> (qtbug133738+0xcf426) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QMetaObject::invokeMethodImpl(QObject*, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, long long, void const* const*, char const* const*, QtPrivate::QMetaTypeInterface const* const*) <null> (libQt6Core.so.6+0x17ce81) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
        Thread T1 'QDBusConnection' (tid=387336, running) created by main thread at:
          #0 pthread_create <null> (qtbug133738+0x4f46d) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QThread::start(QThread::Priority) <null> (libQt6Core.so.6+0x3034a9) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
      SUMMARY: ThreadSanitizer: data race (/home/user/qtbug133738/build/tsan-Debug/qtbug133738+0xcfabe) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f) in operator delete(void*)
      ==================
      ==================
      WARNING: ThreadSanitizer: data race (pid=387332)
        Atomic read of size 1 at 0x7b0c000019b0 by main thread:
          #0 pthread_mutex_lock <null> (qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 <null> <null> (libdbus-1.so.3+0x2112c) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
        Previous write of size 8 at 0x7b0c000019b0 by thread T1 (mutexes: write M0):
          #0 malloc <null> (qtbug133738+0x4dcb1) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 <null> <null> (libdbus-1.so.3+0x32045) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
      
        Location is heap block of size 40 at 0x7b0c000019b0 allocated by thread T1:
          #0 malloc <null> (qtbug133738+0x4dcb1) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 <null> <null> (libdbus-1.so.3+0x32045) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
      
        Mutex M0 (0x7ffff68a9240) created at:
          #0 pthread_mutex_lock <null> (qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 dbus_threads_init <null> (libdbus-1.so.3+0x266bc) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
      
        Thread T1 'QDBusConnection' (tid=387336, running) created by main thread at:
          #0 pthread_create <null> (qtbug133738+0x4f46d) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QThread::start(QThread::Priority) <null> (libQt6Core.so.6+0x3034a9) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
      SUMMARY: ThreadSanitizer: data race (/home/user/qtbug133738/build/tsan-Debug/qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f) in __interceptor_pthread_mutex_lock
      ==================
      ==================
      WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=387332)
        Cycle in lock order graph: M0 (0x7b0c000018f0) => M1 (0x7b0c00001c80) => M0
      
        Mutex M1 acquired here while holding mutex M0 in thread T1:
          #0 pthread_mutex_lock <null> (qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 <null> <null> (libdbus-1.so.3+0x11d40) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
      
          Hint: use TSAN_OPTIONS=second_deadlock_stack=1 to get more informative warning message
      
        Mutex M0 acquired here while holding mutex M1 in thread T1:
          #0 pthread_mutex_lock <null> (qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 <null> <null> (libdbus-1.so.3+0x12d98) (BuildId: 63e8b99215502138cb63afd6d65851a5e837ed49)
      
        Thread T1 'QDBusConnection' (tid=387336, running) created by main thread at:
          #0 pthread_create <null> (qtbug133738+0x4f46d) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f)
          #1 QThread::start(QThread::Priority) <null> (libQt6Core.so.6+0x3034a9) (BuildId: 54ce7800418f9b97e2a97e4ec9ac11014f385f83)
          #2 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 (libc.so.6+0x29d8f) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
      
      SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/home/user/qtbug133738/build/tsan-Debug/qtbug133738+0x6cffa) (BuildId: 054c065bb536df6ff20be43f3d709007b91ce51f) in __interceptor_pthread_mutex_lock
      ==================
      ThreadSanitizer: reported 4 warnings
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cnn Qt Core & Network
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes