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

Duplicate XCB_EXPOSE events create flakiness in many tests

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • QPA: X11/XCB
    • Linux/X11

    Description

      In OpenSUSE/KDE it happens sometimes that the XCB qpa plugin receives twice the EXPOSE event for the created window.

      Many tests that use qWaitForWindowExposed() return from this function call with the window not having focus yet. A second and final EXPOSE event is received together with the FOCUS_IN event later and this causes all kinds of trouble. This was the cause of the crash in QTBUG-104268 for example. Here is part of the log:

      QDEBUG : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() [D] qt.qpa.events qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:206 QXcbConnection::printXcbEvent() - Event | XCB_EXPOSE(12) | sequence: 388
      [...]
      INFO   : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() QVERIFY(QTest::qWaitForWindowExposed(&touchWidget))
      [...]
      QDEBUG : tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() [D] qt.qpa.events qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:206 QXcbConnection::printXcbEvent() - Event | XCB_EXPOSE(12) | sequence: 392
      

      This would explain a lot of flakiness that we have seen in our OpenSUSE platform on our CI. I'll try to link any relevant bugs I find.

      To reproduce the flakiness

      it helps to run the test in a while loop with all logging enabled and QT_SCALE_FACTOR=5. For example

      while QT_SCALE_FACTOR=5 QT_LOGGING_RULES="qt.qpa.events=true"  tst_whatever -v2 -vs specific_testcase ; do : ; done
      

      Solution

      Replace call of qWaitForWindowExposed() with qWaitForWindowActive() which actually waits for the XCB_FOCUS_IN event, which I've only seen being delivered once.

      Attachments

        Issue Links

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

          Activity

            People

              liaqi Liang Qi
              jimis Dimitrios Apostolou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes