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

QPluginLoader not reentrant

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.4.0, 5.15.0 Beta2
    • 5.3.0
    • Core: Plugins
    • None
    • ae6f73e8566fa76470937aca737141183929a5ec (qt/qtbase/5.14.2)

      QLibraryStore::findOrCreate is mutex-protected, but the caller (QPluginLoader::setFileName) then calls d->loadHints = lh and other setters on "d", which race with other theads, if the same plugin is loaded from multiple threads.

      ==14794== 
      ==14794== Possible data race during write of size 4 at 0xF5EAAC0 by thread #21
      ==14794== Locks held: none
      ==14794==    at 0x6633F78: QPluginLoader::setFileName(QString const&) (qpluginloader.cpp:356)
      ==14794==    by 0x6633230: QPluginLoader::QPluginLoader(QString const&, QObject*) (qpluginloader.cpp:158)
      ==14794==    by 0x5EBEBE7: KPluginLoader::findPlugin(QString const&) (kpluginloader.cpp:59)
      ==14794==    by 0x4ED91DB: KIO::Slave::createSlave(QString const&, QUrl const&, int&, QString&) (slave.cpp:461)
      ==14794== 
      ==14794== This conflicts with a previous write of size 4 by thread #12
      ==14794== Locks held: none
      ==14794==    at 0x6633F78: QPluginLoader::setFileName(QString const&) (qpluginloader.cpp:356)
      ==14794==    by 0x6633230: QPluginLoader::QPluginLoader(QString const&, QObject*) (qpluginloader.cpp:158)
      ==14794==    by 0x5EBEBE7: KPluginLoader::findPlugin(QString const&) (kpluginloader.cpp:59)
      ==14794==    by 0x4ED91DB: KIO::Slave::createSlave(QString const&, QUrl const&, int&, QString&) (slave.cpp:461)
      

      Should the QLibraryStore be turned into a QThreadStorage, i.e. one store per thread?

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

            thiago Thiago Macieira
            dfaure David Faure (Private)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: