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

QFactoryLoader is not thread-safe

    XMLWordPrintable

Details

    • 7ca66b1e66e73a0cb35705df04507ef9f3440cab

    Description

      Single sql connection should not be used from a different thread that it is created in (and some drivers may have additional limitations). Correct me if I am wrong, but I believe it should be working in a way that I implemented it in attached example.

      This does not happen every time, but running this example 10 times usually fails somewhere.

      Sometimes error messages are printed, such as:

      QObject::moveToThread: Current thread (0x2577340) is not the object's thread (0x2577960).
      Cannot move to target thread (0x25701e0)
      
      QObject::moveToThread: Current thread (0x25759a0) is not the object's thread (0x2577960).
      Cannot move to target thread (0x25701e0)
      
      QObject::moveToThread: Current thread (0x25766e0) is not the object's thread (0x2577960).
      Cannot move to target thread (0x25701e0)
      

      Sometimes there is an assert:

      ASSERT: "!weakref.load()" in file ../../../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h, line 149
      

      It may also get stuck in qt_call_post_routines() (qcoreapplication.cpp) calling (list->takeFirst())() which makes calls to cleanDriverDict continuously.

      Sometimes it may even crash (see attachment). Sometimes it crashes inside sqlite library too.

      Attachments

        1. crashlog.txt
          12 kB
        2. QTBUG-42855.zip
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            poikelin Joni Poikelin
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes