Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29269

Race Condition when loading Qml Types. results in false errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 10.0.0
    • Quick / QML Support
    • None

    Description

      investigating the bug https://bugreports.qt.io/browse/QTCREATORBUG-29155 where opening the MCU automotive demo and opening automotive.qml results in false "Unknown Component" errors (there is unknown properties as well but that was fixed using qmltypes from the MCU side)
       
      The unknown components however are available in the project root directory in the same folder as the importing file
      adding some logs shows that the folder is imported and searched
       
      imports printed in qmljscontext.cpp::contextLookupType importObj->all (joined with paths) :

      thread 5f80 File:automotive.qml, Type:PerformanceMetrics QML|C:/Qt/QtMCUs/2.5.0/demos/automotive|QtQuick|QtQuickUltralite/Extras|Automotive

       
      Adding two logging point , MCUIMPORT in (qmljslink::importFileOrDirectory) and MCUSNAPSHOT in (qmljsdocument.cpp::Snapshot::insert) shows that the syntax check is being performed while the snapshot is still being feed new components (logs with different thread number)

      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/Navi.qml5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalMode.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/NormalModeContentItem.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetricItem.qml
      5f80 MCUIMPORT> C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> type is a directory importing lib
      5f80 MCUIMPORT> Size of documents in dir16
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added BaseGauge
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added CarStatus
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added DriveModeSelector
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added Gauge
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added GuideArrow
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added GuideArrowItem
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added LaneAssist
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added LaneAssistWhiteLine
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added LinearGauge
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added MediaPlayer
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added Menu
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added MiddleGauge
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added Navi
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added NormalMode
      5f80 MCUIMPORT> type is a directory importing doc C:/Qt/QtMCUs/2.5.0/demos/automotive
      5f80 MCUIMPORT> Member added NormalModeContentItem
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/PerformanceMetrics.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qml
      5820 MCUSNAPSHOT> Loading C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qml
      5820 MCUSNAPSHOT> Inserted C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qml
      5820 MCUSNAPSHOT> Done C:/Qt/QtMCUs/2.5.0/demos/automotive/Phone.qm

       
       
      One attempt to solve this was to use test_joinAllThreads() to wait for the modelManager futures to finish in qmljssemanticinfoupdater.cpp::makeNewSemanticInfo

      Linklink(semanticInfo.snapshot, modelManager->defaultVContext(doc->language(), doc), modelManager->builtins(doc));
      modelManager->test_joinAllThreads();
      semanticInfo.context=link(doc, &semanticInfo.semanticMessages);
       

       
      The order is then correct (snapshot is filled with all items before the checker() is called). but the error persist as it seems the checker still use an outdated snapshot copy (passed to the constructor)

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              yasser Yasser Grimes
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes