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

Scene graph threaded render loop deadlocks on X11

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P0: Blocker
    • 5.2.0
    • 5.2.0 RC1
    • Quick: SceneGraph
    • None
    • Linux 3.9.10, Fedora 17, X.org 1.12.4, XCB 1.9 (QPA plugin uses system library), Mesa 8.0.4, KDE 4.12-pre
      Running KWin as window manager and compositor (problem remains with and without compositing)
    • a6348870ee1fc7b0270ceebf0f13dee7e5e54719

    Description

      The scene graph deadlocks on X11. Qt Creator is unusable. This problem was introduced by 99480d5420c0beea6771be582c039b550a4461f5 – if that commit is reverted, the problem disappears.

      Steps to reproduce:

      1. start Qt Creator

      Error message when running it:

      $ QSG_INFO=1 qtcreator-qt5
      QSG: threaded render loop 
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      ^C
      

      Problem does not happen with the basic renderer:

      $ QSG_INFO=1 QSG_RENDER_LOOP=basic qtcreator-qt5
      QSG: basic render loop 
      QSG: texture atlas dimensions: 2048 x 1024 
      GL_VENDOR:      Tungsten Graphics, Inc 
      GL_RENDERER:    Mesa DRI Intel(R) Sandybridge Mobile  
      GL_VERSION:     OpenGL ES 2.0 Mesa 8.0.4 
      GL_EXTENSIONS:
          GL_EXT_blend_minmax
          GL_EXT_multi_draw_arrays
          GL_EXT_texture_filter_anisotropic
          GL_EXT_texture_format_BGRA8888
          GL_OES_depth24
          GL_OES_element_index_uint
          GL_OES_fbo_render_mipmap
          GL_OES_mapbuffer
          GL_OES_rgb8_rgba8
          GL_OES_standard_derivatives
          GL_OES_stencil8
          GL_OES_texture_3D
          GL_OES_texture_npot
          GL_OES_EGL_image
          GL_OES_depth_texture
          GL_OES_packed_depth_stencil
          GL_EXT_texture_type_2_10_10_10_REV
          GL_NV_fbo_color_attachments
          GL_NV_draw_buffers
      

      Backtrace of the deadlock:

      Thread 4 (Thread 0x7fff9bffd700 (LWP 99980)):
      #0  0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
          at ../sysdeps/unix/sysv/linux/poll.c:87
      #1  0x0000003e6a847af4 in ?? () from /lib64/libglib-2.0.so.0
      #2  0x0000003e6a847c14 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
      #3  0x00007ffff6d3ddd5 in QEventDispatcherGlib::processEvents (this=0x7fff940008c0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:426
      #4  0x00007ffff6cbcfd6 in QEventLoop::processEvents (this=0x7fff9bffccc0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:136
      #5  0x00007ffff6cbd2c6 in QEventLoop::exec (this=0x7fff9bffccc0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:212
      #6  0x00007ffff6a3d735 in QThread::exec (this=0xc9ce80)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread.cpp:509
      #7  0x00007fffe7d9217d in QQmlThreadPrivate::run (this=0xc9ce80)
          at /home/thiago/src/qt/qt5/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:148
      #8  0x00007ffff6a45567 in QThreadPrivate::start (arg=0xc9ce80)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:345
      #9  0x0000003e69407d14 in start_thread (arg=0x7fff9bffd700) at pthread_create.c:309
      #10 0x0000003e688f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
      
      Thread 3 (Thread 0x7fffe0d03700 (LWP 99979)):
      #0  0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
          at ../sysdeps/unix/sysv/linux/poll.c:87
      #1  0x0000003e6a847af4 in ?? () from /lib64/libglib-2.0.so.0
      #2  0x0000003e6a847c14 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
      #3  0x00007ffff6d3ddf5 in QEventDispatcherGlib::processEvents (this=0x7fffdc0008c0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:428
      #4  0x00007ffff6cbcfd6 in QEventLoop::processEvents (this=0x7fffe0d02cc0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:136
      #5  0x00007ffff6cbd2c6 in QEventLoop::exec (this=0x7fffe0d02cc0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:212
      #6  0x00007ffff6a3d735 in QThread::exec (this=0xa41cc0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread.cpp:509
      #7  0x00007ffff6a3d8dc in QThread::run (this=0xa41cc0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread.cpp:576
      #8  0x00007ffff6a45567 in QThreadPrivate::start (arg=0xa41cc0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:345
      #9  0x0000003e69407d14 in start_thread (arg=0x7fffe0d03700) at pthread_create.c:309
      #10 0x0000003e688f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
      
      Thread 2 (Thread 0x7fffeea4e700 (LWP 99909)):
      #0  0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>)
          at ../sysdeps/unix/sysv/linux/poll.c:87
      #1  0x0000003e6ac09f22 in ?? () from /lib64/libxcb.so.1
      #2  0x0000003e6ac0b6af in xcb_wait_for_event () from /lib64/libxcb.so.1
      #3  0x00007ffff0422e11 in QXcbEventReader::run (this=0x444ec0)
          at /home/thiago/src/qt/qt5/qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:1008
      #4  0x00007ffff6a45567 in QThreadPrivate::start (arg=0x444ec0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:345
      #5  0x0000003e69407d14 in start_thread (arg=0x7fffeea4e700) at pthread_create.c:309
      #6  0x0000003e688f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
      
      Thread 1 (Thread 0x7ffff6919800 (LWP 99906)):
      #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:166
      #1  0x00007ffff6a46df3 in QWaitConditionPrivate::wait (this=0x11b6a20, time=18446744073709551615)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qwaitcondition_unix.cpp:136
      #2  0x00007ffff6a46b9d in QWaitCondition::wait (this=0x11b7208, mutex=0x11b7200, time=18446744073709551615)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/thread/qwaitcondition_unix.cpp:208
      #3  0x00007fffe733c034 in QSGThreadedRenderLoop::polishAndSync (this=0xc9aa10, w=0x11b7650)
          at /home/thiago/src/qt/qt5/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:1106
      #4  0x00007fffe733c3d9 in QSGThreadedRenderLoop::event (this=0xc9aa10, e=0x7fffffffc3d0)
          at /home/thiago/src/qt/qt5/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:1170
      #5  0x00007ffff78c4ec8 in QApplicationPrivate::notify_helper (this=0x41df00, receiver=0xc9aa10, e=0x7fffffffc3d0)
          at /home/thiago/src/qt/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3467
      ---Type <return> to continue, or q <return> to quit---
      #6  0x00007ffff78c2061 in QApplication::notify (this=0x7fffffffc800, receiver=0xc9aa10, e=0x7fffffffc3d0)
          at /home/thiago/src/qt/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2888
      #7  0x00007ffff6cc0850 in QCoreApplication::notifyInternal (this=0x7fffffffc800, receiver=0xc9aa10, event=0x7fffffffc3d0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:871
      #8  0x00007ffff6cc45f5 in QCoreApplication::sendEvent (receiver=0xc9aa10, event=0x7fffffffc3d0)
          at ../../include/QtCore/../../../../../../src/qt/qt5/qtbase/src/corelib/kernel/qcoreapplication.h:232
      #9  0x00007ffff6d3c07d in QTimerInfoList::activateTimers (this=0x47b3a0)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qtimerinfo_unix.cpp:643
      #10 0x00007ffff6d3d419 in timerSourceDispatch (source=0x47b340)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:185
      #11 0x0000003e6a847825 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
      #12 0x0000003e6a847b58 in ?? () from /lib64/libglib-2.0.so.0
      #13 0x0000003e6a847c14 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
      #14 0x00007ffff6d3ddd5 in QEventDispatcherGlib::processEvents (this=0x41f150, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:426
      #15 0x00007ffff045c806 in QPAEventDispatcherGlib::processEvents (this=0x41f150, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp:123
      #16 0x00007ffff6cbcfd6 in QEventLoop::processEvents (this=0x7fffffffc6d0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:136
      #17 0x00007ffff6cbd2c6 in QEventLoop::exec (this=0x7fffffffc6d0, flags=...)
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:212
      #18 0x00007ffff6cc0f14 in QCoreApplication::exec ()
          at /home/thiago/src/qt/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1124
      #19 0x00007ffff70e86b8 in QGuiApplication::exec ()
          at /home/thiago/src/qt/qt5/qtbase/src/gui/kernel/qguiapplication.cpp:1332
      #20 0x00007ffff78c18ad in QApplication::exec () at /home/thiago/src/qt/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2692
      #21 0x000000000040ef42 in main (argc=1, argv=0x7fffffffd8b8) at /home/thiago/src/qt/creator/src/app/main.cpp:533
      (gdb) i thr
        Id   Target Id         Frame 
        4    Thread 0x7fff9bffd700 (LWP 99980) "QThread" 0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, 
          nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
        3    Thread 0x7fffe0d03700 (LWP 99979) "QThread" 0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, 
          nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
        2    Thread 0x7fffeea4e700 (LWP 99909) "QXcbEventReader" 0x0000003e688e8bdf in __GI___poll (fds=<optimized out>, 
          nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
      * 1    Thread 0x7ffff6919800 (LWP 99906) "qtcreator-qt5" pthread_cond_wait@@GLIBC_2.3.2 ()
          at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:166
      

      (I guess the renderer thread is Thread 3)

      When the loop is compiled with debugging, it prints:

      (218194028) line= 705 - win=       0x0): Gui: QSGThreadedRenderLoop() created
      (218195897) line= 794 - win= 0x11ef560): Gui: show()
      (218195897) line= 813 - win= 0x11ef560): Gui:  - now tracking new window
      (218196025) line=1001 - win= 0x11ef560): Gui: maybeUpdate...
      (218196025) line=1001 - win= 0x11ef560): Gui: maybeUpdate...
      (218196027) line= 874 - win= 0x11ef560): Gui: exposureChanged()
      (218196027) line= 905 - win= 0x11ef560): Gui: handleExposure
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      (218196036) line= 748 - win=       0x0): Gui: animationStarted()
      (218196036) line= 716 - win= 0x11ef560): Gui:  - posting update
      (218196049) line= 874 - win= 0x11ef560): Gui: exposureChanged()
      (218196049) line= 905 - win= 0x11ef560): Gui: handleExposure
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      (218196049) line= 874 - win= 0x11ef560): Gui: exposureChanged()
      (218196049) line= 905 - win= 0x11ef560): Gui: handleExposure
      QSGThreadedRenderLoop: expose event received for window with invalid geometry.
      (218196049) line= 757 - win=       0x0): Gui: animationStopped()
      (218196049) line=1161 - win=       0x0): Gui: QEvent::Timer -> Polish & Sync
      (218196049) line=1066 - win= 0x11ef560): Gui: polishAndSync()
      (218196100) line=1001 - win= 0x11ef560): Gui: maybeUpdate...
      (218196100) line=1001 - win= 0x11ef560): Gui: maybeUpdate...
      [repeat ad nauseam]
      (218196532) line=1001 - win= 0x11ef560): Gui: maybeUpdate...
      (218196532) line=1096 - win= 0x11ef560): Gui:  - lock for sync...
      (218196532) line=1101 - win= 0x11ef560): Gui:  - wait for sync...
      

      Attachments

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              thiago Thiago Macieira
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes