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

QNetworkDiskCache leaks file descriptors

XMLWordPrintable

    • All
    • 27f939da8 (dev), fd456b46c (6.10), 113fdd928 (6.9), 238114e46 (tqtc/lts-6.8), 3a67f2347 (tqtc/lts-6.5)

      When cache files are expired, existing open file descriptors to those files are not removed, causing a leak of file descriptors.

       

      This was initially reported and fixed as QTBUG-36076, but the issue was re-introduced in QTBUG-111397. More specifically, commit e5f295c8a removes the following lines in QNetworkDiskCache::expire:

       

      -        if (cached.path.contains(PREPARED_SLASH)) {
      -            auto matchesCacheItem = [&cached](QCacheItem *item) {
      -                return item && item->file && item->file->fileName() == cached.path;
      -            };
      -            auto itemIt = std::find_if(d->inserting.cbegin(), d->inserting.cend(), matchesCacheItem);
      -            if (itemIt != d->inserting.cend()) {
      -                auto &tempfile = (*itemIt)->file;
      -                delete tempfile;
      -                tempfile = nullptr;
      -            }
      -        } 

       

       

      which were responsible for avoiding the leak.

        1. main.cpp
          0.8 kB
          Basile Clement
        For Gerrit Dashboard: QTBUG-135641
        # Subject Branch Project Status CR V

            manordheim Mårten Nordheim
            bclement Basile Clement
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes