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

Crash occurs when QHash::find is used within QFileSystemWatcher

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Incomplete
    • Affects Version/s: 5.9.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      I have 2 threads. First removes paths from watching. Second thread (main) periodically calls 'processEvents' for Qt dispatcher. This produces access to same watcher from other thread.
      Crash is rare and cannot be easily reproduced. I see there is broken QNode with this=0x20.
      Core dump tells me there is broken 'node' variable within 'findNode(const Key &akey, uint h) const' method. I tried to evaluate some expressions in GDB to see what address is returned from buckets, but seems it's okay from GDB.

      Any idea why this happens? Code successfully works with Qt 4.8.6.

      #0  0x00007f4aa82c6af7 in inotify_rm_watch () at ../sysdeps/unix/syscall-template.S:84
      #1  0x00007f4abacb5665 in QInotifyFileSystemWatcherEngine::removePaths (this=0x2026260, paths=..., files=0x240c290, directories=0x240c298) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/io/qfilesystemwatcher_inotify.cpp:332
      #2  0x00007f4abac8b70f in QFileSystemWatcher::removePaths (this=this@entry=0x21da410, paths=Python Exception <class 'RuntimeError'> Type is not a template.: 
      ) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/io/qfilesystemwatcher.cpp:440
      #3  0x00007f4abac8b8d4 in QFileSystemWatcher::removePath (this=0x21da410, path=...) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/io/qfilesystemwatcher.cpp:406
      
      #0  QHashNode<int, QString>::same_key (key0=@0x7ffdcd1a969c: -20734, h0=3856215977, this=0x20) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/include/QtCore/../../src/corelib/tools/qhash.h:158
      #1  QHash<int, QString>::findNode (this=<optimized out>, akey=@0x7ffdcd1a969c: -20734, h=3856215977) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/include/QtCore/../../src/corelib/tools/qhash.h:908
      #2  0x00007f4abacb69d9 in QHash<int, QString>::findNode (this=this@entry=0x2026280, akey=@0x7ffdcd1a969c: -20734, akey@entry=@0x7ffdcd1a969c: <optimized out>, ahp=ahp@entry=0x0)
          at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/include/QtCore/../../src/corelib/tools/qhash.h:927
      #3  0x00007f4abacb4a9b in QHash<int, QString>::find (akey=@0x7ffdcd1a969c: -20734, this=0x2026280) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/include/QtCore/../../src/corelib/tools/qhash.h:878
      #4  QInotifyFileSystemWatcherEngine::getPathFromID (this=this@entry=0x2026260, id=<optimized out>) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/io/qfilesystemwatcher_inotify.cpp:408
      #5  0x00007f4abacb5cfa in QInotifyFileSystemWatcherEngine::readFromInotify (this=0x2026260) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/io/qfilesystemwatcher_inotify.cpp:380
      #6  0x00007f4abacb60ab in QInotifyFileSystemWatcherEngine::qt_static_metacall (_o=_o@entry=0x2026260, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=<optimized out>) at .moc/moc_qfilesystemwatcher_inotify_p.cpp:72
      #7  0x00007f4abad44199 in QMetaObject::activate (sender=sender@entry=0x2026288, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffdcd1aa880)
          at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qobject.cpp:3766
      #8  0x00007f4abad44523 in QMetaObject::activate (sender=sender@entry=0x2026288, m=m@entry=0x7f4abaffde60 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffdcd1aa880)
          at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qobject.cpp:3628
      #9  0x00007f4abad50463 in QSocketNotifier::activated (this=this@entry=0x2026288, _t1=<optimized out>, _t2=...) at .moc/moc_qsocketnotifier.cpp:137
      #10 0x00007f4abad508e3 in QSocketNotifier::event (this=0x2026288, e=<optimized out>) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qsocketnotifier.cpp:266
      #11 0x00007f4abad1471c in QCoreApplicationPrivate::notify_helper (receiver=receiver@entry=0x2026288, event=event@entry=0x7ffdcd1aaa10) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1152
      #12 0x00007f4abad147a3 in doNotify (receiver=0x2026288, event=0x7ffdcd1aaa10) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1093
      #13 0x00007f4abad14899 in QCoreApplication::notify (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1079
      #14 0x00007f4abad14840 in QCoreApplication::notifyInternal2 (receiver=receiver@entry=0x2026288, event=event@entry=0x7ffdcd1aaa10) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1018
      #15 0x00007f4abad6a67d in QCoreApplication::sendEvent (event=0x7ffdcd1aaa10, receiver=<optimized out>) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:233
      #16 QEventDispatcherUNIXPrivate::activateSocketNotifiers (this=this@entry=0x1a159d0) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:304
      #17 0x00007f4abad6ab68 in QEventDispatcherUNIX::processEvents (this=<optimized out>, flags=...) at /home/builder/work/qt-everywhere-opensource-src-5.9.1/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:509
      

        Attachments

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

          Activity

            People

            • Assignee:
              thiago Thiago Macieira
              Reporter:
              bogdangureev bogdangureev
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes