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

Qt wayland client' main thread blocks if it is not visible on the compositor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.11.1, 5.12.1
    • QPA: Wayland
    • None
    • Target OS: Automotive Grade Linux
      Target architecture: aarch64

      QT_QPA_PLATFORM=eglfs
    • Linux/Wayland

    Description

      Problem description

      QtWaylandClient blocks the main thread when it is not visible in the compositor window.
      The thread continues if the client application is brought to foreground (i.e. visible). It is suspected that the wayland client waits for an event from the wayland compositor.

      The issue causing the client to block is reproducible in two cases:

      1. When a client is connected,  its wayland surface is attached to a surfaceItem (with visible: false)
      2. When a client is connected, its wayland surface is attached to a surfaceItem (with visible: true). After that, the surfaceItem is destroyed.

      Test apps

      wayland_client_cond_wait.7z contains Qt example apps to reproduce the issue.

      More information

      Here is a backtrace from the wayland client application:

      #0  0x0000007f80fa5550 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x1dfc31c) at /usr/src/debug/glibc/2.25-r0/git/sysdeps/unix/sysv/linux/futex-internal.h:88
      88	/usr/src/debug/glibc/2.25-r0/git/sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
      (gdb) bt full
      #0  0x0000007f80fa5550 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x1dfc31c) at /usr/src/debug/glibc/2.25-r0/git/sysdeps/unix/sysv/linux/futex-internal.h:88
              __ret = <optimized out>
              oldtype = 0
              err = <optimized out>
      #1  __pthread_cond_wait_common (abstime=0x0, mutex=0x1dfc2b8, cond=0x1dfc2f0) at /usr/src/debug/glibc/2.25-r0/git/nptl/pthread_cond_wait.c:502
              spin = 0
              buffer = {__routine = 0x7f80fa5380 <__condvar_cleanup_waiting>, __arg = 0x7fd1bfdb20, __canceltype = -775955160, __prev = 0x0}
              cbuffer = {wseq = 27, cond = 0x1dfc2f0, mutex = 0x1dfc2b8, private = 0}
              err = <optimized out>
              g = 1
              flags = <optimized out>
              signals = 0
              result = 0
              seq = 13
      #2  __pthread_cond_wait (cond=cond@entry=0x1dfc2f0, mutex=mutex@entry=0x1dfc2b8) at /usr/src/debug/glibc/2.25-r0/git/nptl/pthread_cond_wait.c:655
      No locals.
      #3  0x0000007f7b6114b8 in read_events (display=0x1dfc1e0) at /usr/src/debug/wayland/1.9.0-r0/wayland-1.9.0/src/wayland-client.c:1225
              serial = 1669
      #4  0x0000007f7b61241c in wl_display_read_events (display=0x1dfc1e0) at /usr/src/debug/wayland/1.9.0-r0/wayland-1.9.0/src/wayland-client.c:1324
              ret = <optimized out>
      #5  0x0000007f7b68bdf0 in QtWaylandClient::QWaylandDisplay::flushRequests (this=0x1dfc0e0) at /usr/src/debug/qtwayland/5.11.1+gitAUTOINC+3ffa7d5d6e-r0/git/src/client/qwaylanddisplay.cpp:179
      No locals.
      #6  0x0000007f800d8b44 in QMetaObject::activate (sender=0x7fd1bfde70, sender@entry=0x1e04d60, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0)
          at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/corelib/kernel/qobject.cpp:3771
              method_relative = 1
              callFunction = 0x7f7b6b39a8 <QtWaylandClient::QWaylandDisplay::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>
              receiver = 0x1dfc0e0
              receiverInSameThread = <optimized out>
              sw = {receiver = 0x1dfc0e0, previousSender = 0x0, currentSender = {sender = 0x1e04d60, signal = 4, ref = 1}, switched = true}
              c = 0x1df0dc0
              last = 0xa
              locker = {val = 547612130520}
      ---Type <return> to continue, or q <return> to quit---
              connectionLists = {connectionLists = 0x1dea220}
              list = 0x24
              currentThreadId = 0x1decfd0
              signal_index = 0
              empty_argv = {0x0}
      #7  0x0000007f800d922c in QMetaObject::activate (sender=sender@entry=0x1e04d60, m=<optimized out>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0)
          at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/corelib/kernel/qobject.cpp:3633
      No locals.
      #8  0x0000007f800a8ddc in QAbstractEventDispatcher::awake (this=this@entry=0x1e04d60) at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/build/src/corelib/.moc/moc_qabstracteventdispatcher.cpp:144
      No locals.
      #9  0x0000007f800ff84c in QEventDispatcherUNIX::processEvents (this=0x1e04d60, flags=..., flags@entry=...)
          at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/corelib/kernel/qeventdispatcher_unix.cpp:465
              d = 0x1e05130
              include_timers = <optimized out>
              include_notifiers = <optimized out>
              wait_for_events = <optimized out>
              canWait = <optimized out>
              tm = <optimized out>
              wait_tm = {tv_sec = 548979858928, tv_nsec = 547531530216}
              nevents = <optimized out>
      #10 0x0000007f7b6c1fdc in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...)
          at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp:68
              didSendEvents = <optimized out>
      #11 0x0000007f800aab34 in QEventLoop::exec (this=this@entry=0x7fd1bfdec0, flags=..., flags@entry=...) at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/corelib/kernel/qeventloop.cpp:214
              d = 0x20f7950
              locker = {val = 31395200}
              ref = {d = 0x20f7950, locker = @0x7fd1bfdea8, exceptionCaught = true}
      #12 0x0000007f800b33c8 in QCoreApplication::exec () at /usr/src/debug/qtbase/5.11.1+gitAUTOINC+74305ba470-r0/git/src/corelib/kernel/qcoreapplication.cpp:1336
      

      Attachments

        Issue Links

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

          Activity

            People

              johanhelsing Johan Helsing
              anton-i Anton Indrawan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes