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

Race condition in UniformBlockValueBuilder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.6.3, 6.7.0 RC, 6.8.0 FF
    • 6.4.2
    • Qt3D
    • None
    • Windows, Visual Studio 2022 build
    • Windows
    • c6fafcb66 (dev), 96f5d91b0 (6.7), 9c6ab32a9 (6.6)

    Description

      UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper has a race condition that occasionally causes applications to crash.

      The following lines seem to have a potential race.

      const int fullBlockNameId = StringToInt::lookupId(fullBlockName);
          if (!rShaderData->hasPropertyValuesForBlock(fullBlockNameId))
              rShaderData->generatePropertyValuesForBlock(fullBlockName);
          const ShaderData::PropertyValuesForBlock &propertiesForBlock = rShaderData->propertyValuesForBlock(fullBlockNameId);

      It is possible for multiple threads to enter "generatePropertyValuesForBlock" on the same ShaderData object.  This means one thread can have set the property values and have them returned from the call to "propertyValuesForBlock", but then while processing the returned value, the other thread will replace the ShaderData::PropertyValuesForBlock as it finishes its call to "generatePropertyValuesForBlock" leading to a crash.  Either a mutex needs to be held throughout this function or the ShaderData::PropertyValuesForBlock needs to be returned by value instead of by reference so that when the other thread replaces it, it does not become invalid.

      Attachments

        For Gerrit Dashboard: QTBUG-111427
        # Subject Branch Project Status CR V

        Activity

          People

            seanharmer Sean Harmer
            daz_cjones Christopher Jones
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes