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

QFileSystemWatcher::addPath() is slow on macos

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.10
    • None

    Description

      QFileSystemWatcher::addPath() is slow on my arm macbook. It causes a freeze in Qt Creator (QTCREATORBUG-33191) and I managed to construct a reproducer without Qt Creator, see attached zip.

      The reproducer creates 1000 files in a temporary directory, watches the directory, then modifies the files in the temporary directory, and gets a directoryChanged signal (up to here everything good).
      After receiving the directoryChanged signal, it will do QFileSystemWatcher::addPath().
      Expected behavior: addPath() returns in a timely fashioin
      Observed behavior: addPath() spends more than 6 seconds in FSEventStreamFlushSync()

      I get following output from the reproducer:

      [     0.000] Creating files
      [     0.099] Done!
      [     0.099] Creating watch!
      [     0.133] Done!
      [     0.133] Running event loop!
      [     0.184] Modifying folder!
      [     0.244] Done!
      [     0.251] Directory Changed!
      [     0.251] Adding path in onDirectoryChanged
      [     6.918] Done!
      

      Note the 6 seconds difference between "Adding path in onDirectoryChanged" and "Done!".

      Also note that in QTCREATORBUG-33191, the CMake extension actually watches a folder with ~9000 files when opening the qt project and building qtdeclarative, and there we wait for more than 6 seconds.

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              sami.shalayel Sami Shalayel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: