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

QWaylandWindow::waitForFrameSync() nested call causes application freeze

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.12.5
    • QPA: Wayland
    • None
    • Linux/Wayland

    Description

      Hi,

      the stacktrace is from my own project, but it highly looks like my main (render) thread is frozen because of a recursive lock in QWaylandWindow::waitForFrameSync(int).

      It is noteworthy that in this stack trace, for some reason my application's TerminalWindow::event(QEvent*) is also recursively invoked, which I am not sure that this is intended, however, in the inner event handling, the mutex is already locked by the outer call to waitForFrameSync() in the wayland code base, hence the freeze.

      It looks like a bug in the QtWayland code base, that's why I am posting it here. I hope however, that I am wrong and it's my fault instead.

      • OS: Ubuntu 19.10, with Qt 5.12.5; I upgraded from 19.04 (Qt 5.12.4) in the hopes to get this issue fixed.
      • Window Manager: Sway
      • running the app in with xcb backend works just fine.

      The following snipped is the stack trace as captured at SIGINT:

       46: syscall (syscall.S:38) 
       45: _q_futex (qfutex_p.h:92) 
       44: futexWait<QBasicAtomicPointer<QMutexData> > (qfutex_p.h:107) 
       43: lockInternal_helper<false> (qmutex_linux.cpp:142) 
       42: QBasicMutex::lockInternal() (qmutex_linux.cpp:159) 
       41: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) 
       40: QMutexLocker (qmutex.h:206) 
       39: QtWaylandClient::QWaylandWindow::waitForFrameSync(int) (qwaylandwindow.cpp:664) 
       38: QtWaylandClient::QWaylandGLContext::swapBuffers(QPlatformSurface*) (qwaylandglcontext.cpp:566)
       37: QOpenGLContext::swapBuffers(QSurface*) (qopenglcontext.cpp:1112) 
       36: QOpenGLWindowPrivate::flush(QRegion const&) (qopenglwindow.cpp:335) 
       35: doFlush (qpaintdevicewindow_p.h:105) 
       34: handleUpdateEvent (qpaintdevicewindow_p.h:112) 
       33: QPaintDeviceWindow::event(QEvent*) (qpaintdevicewindow.cpp:202) 
       32: contour::TerminalWindow::event(QEvent*) (TerminalWindow.cpp:581) 
       31: QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:1088) 
       30: QPlatformWindow::deliverUpdateRequest() (qplatformwindow.cpp:793) 
       29: operator() (qwaylandwindow.cpp:650) 
       28: operator() (qwaylandwindow.cpp:641) 
       27: QtWaylandClient::QWaylandWindow::handleFrameCallback() (qwaylandwindow.cpp:656) 
       26: ffi_call_unix64 (unix64.S:101) 
       25: ffi_call_int (ffi64.c:669) 
       24: wl_closure_invoke (connection.c:1018) 
       23: dispatch_event.isra.0 (wayland-client.c:1445) 
       22: dispatch_queue (wayland-client.c:1591) 
       21: wl_display_dispatch_queue_pending (wayland-client.c:1833) 
       20: QtWaylandClient::QWaylandDisplay::dispatchQueueWhile(wl_event_queue*, std::function<bool ()>, int) (qwaylanddisplay.cpp:225)
       19: QtWaylandClient::QWaylandWindow::waitForFrameSync(int) (qwaylandwindow.cpp:669) 
       18: QtWaylandClient::QWaylandGLContext::swapBuffers(QPlatformSurface*) (qwaylandglcontext.cpp:566)
       17: QOpenGLContext::swapBuffers(QSurface*) (qopenglcontext.cpp:1112) 
       16: QOpenGLWindowPrivate::flush(QRegion const&) (qopenglwindow.cpp:335) 
       15: doFlush (qpaintdevicewindow_p.h:105) 
       14: QPaintDeviceWindow::exposeEvent(QExposeEvent*) (qpaintdevicewindow.cpp:189) 
       13: QWindow::event(QEvent*) (qwindow.cpp:2347) 
       12: QPaintDeviceWindow::event(QEvent*) (qpaintdevicewindow.cpp:206) 
       11: contour::TerminalWindow::event(QEvent*) (TerminalWindow.cpp:581) 
       10: QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:1088) 
       9: QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) (qguiapplication.cpp:3071)
       8: QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) (qguiapplication.cpp:1907)
       7: QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qwindowsysteminterface.cpp:1151)
       6: userEventSourceDispatch(_GSource*, int (*)(void*), void*) (in /usr/lib/x86_64-linux-gnu/libQt5WaylandClient.so.5.12.5)
       5: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.1) 
       4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.1) 
       3: g_main_context_iteration (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.1) 
       2: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:422)
       1: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:225) 
       1378: QCoreApplication::exec() (qcoreapplication.cpp:1389) 
       1: main (main.cpp:77) 
      

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            christianparpart Christian Parpart
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes