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

QOpenGLProgramBinaryCache is not thread safe, but is used statically, potentially from multiple threads

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.3
    • Fix Version/s: 5.12.5, 5.14.0 Alpha
    • Component/s: GUI: OpenGL
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      257bd49c1f47ba5fca6930082fdcf108f9d24e3f (qt/qtbase/5.12)

      Description

      https://code.woboq.org/qt5/qtbase/src/gui/opengl/qopenglshaderprogram.cpp.html#3818 declares a single static cache object for all QOpenGLShaderProgram instances.  My application uses multiple different threads to render QML UI to offscreen surfaces, with each QML context associated with it's own rendering thread per the documentation for QQuickRenderControl:  https://doc.qt.io/qt-5/qquickrendercontrol.html 

       

      I'm seeing occasional crashes with a stack trace that ends in QOpenGLProgramBinaryCache::load, line 326, which is calling into QCache and QHash.  I haven't been able to reproduce this in a debugger yet, but I assume that the lack of locking around `m_memCache` in the load function means that QOpenGLProgramBinaryCache isn't thread safe.

        Attachments

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

          Activity

            People

            Assignee:
            lagocs Laszlo Agocs
            Reporter:
            jherico Bradley Austin Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes