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

TSAN build of GLib+DBus+Qt 6.4 shows TSAN warnings with a tiny QApplication example

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 6.4.0, 6.4.1
    • Core: Plugins, D-Bus
    • None
    • fresh & up to date Ubuntu 22.04, fully able to build Qt5 and Qt6.x useable with my big projects
    • Linux/Wayland
    • 21
    • Foundation PM Staging

    Description

      Background: I'm currently testing a green-field 400kLOC project with ASAN and TSAN (in the future with MSAN).
      There is some sort of simple communication server holding all my stuff together which is based on Qt and this server is giving me some TSAN warnings from Qt code – I've compiled all relevant third parties which Qt is using and Qt and my server itself with TSAN (in my case only GLib and DBus) to get rid of false-positives.

      Later i will try to ASAN/TSAN test a very organic grown Qt5→Qt6 port of a ~1Mio LOC project and hope to get rid of the most basic ASAN/TSAN findings before – at least with Qt dev branch so the next upcoming releases are cleaner for my testing.

      Currently a simple QApplication program throws a good amount of TSAN warnings on start/exit and I've got some other simple Qt unit-tests that contains more warnings.

      My build instructions:

      mkdir ~/qt6_dev
      

      1. build Glib with TSAN

      cd ~/qt6_dev
      git clone https://gitlab.gnome.org/GNOME/glib.git
      cd glib
      git checkout 2.72.1
      cd ..
      mkdir glib-build
      cd glib-build
      meson setup ../glib -Dbuildtype=debug -Db_sanitize=thread --prefix
      ~/qt6_dev/glib-install
      meson compile
      meson install
      

      2. build DBus with TSAN (using TSAN-Glib)

      git clone https://github.com/freedesktop/dbus.git
      cd dbus
      git checkout dbus-1.12.20
      cd ..
      mkdir dbus-build
      cd dbus-build
      PKG_CONFIG_PATH=~/qt6_dev/glib-install/lib/x86_64-linux-gnu/pkgconfig
      cmake ../dbus/cmake -DCMAKE_INSTALL_PREFIX=~/qt6_dev/dbus-install
      -DCMAKE_CXX_FLAGS="-g -fno-omit-frame-pointer -fsanitize=thread"
      -DCMAKE_C_FLAGS="-g -fno-omit-frame-pointer -fsanitize=thread"
      -DCMAKE_EXE_LINKER_FLAGS="-fno-omit-frame-pointer -fsanitize=thread"
      -DCMAKE_MODULE_LINKER_FLAGS="-fno-omit-frame-pointer -fsanitize=thread"
      cmake --build . --parallel 6
      cmake --install .
      

      3. build Qt 6.4(with patch:
      https://codereview.qt-project.org/c/qt/qtbase/+/442720 – my first ASAN finding) with TSAN

      cd ~/qt6_dev
      git clone git://code.qt.io/qt/qt5.git qt6
      cd qt6
      perl init-repository
      git checkout v6.4.0
      # apply patch
      cd ..
      mkdir qt6-build
      cd qt6-build
      PKG_CONFIG_PATH=~/qt6_dev/glib-install/lib/x86_64-linux-gnu/pkgconfig:~/qt6_dev/dbus-install/lib/pkgconfig
      ../qt6/qtbase/configure -debug -opensource -nomake examples -nomake
      tests -sanitize thread -prefix ~/qt6_dev/qt6-install
      cmake --build . --parallel 6
      cmake --install .
      

      problem: qt6 cmake ignores for unknown reasons my TSAN dbus lib so we later use LD_LIBRARY_PATH to force TSAN dbus lib loading (see QTBUG-108783).

      4. build simple example qt_tsan_tests with TSAN

      int main( int argc, char* argv[] )
      {
          QApplication app( argc, argv );
      
          QWidget window;
          window.resize( 320, 240 );
          window.show();
      
          return app.exec();
      }
      

      5. start example with

      LD_LIBRARY_PATH=~/qt6_dev/dbus-install/lib:$LD_LIBRARY_PATH ./qt_tsan_tests
      

      see attached TSAN warnings.

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              llm Dennis Lühring
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes