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

QSystemTrayIcon (and QWebEngineView and other classes) somehow leaks opened file descriptors on GTK-based DEs?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Related bug report: https://github.com/martinrotter/rssguard/issues/565

      EDIT3: Uploaded minimal example which just calls "QSystemTrayIcon::isSystemTrayAvailable()" repeatedly. It leaks out of 1024 opened files/handles in few minutes. traytest.zip

      What am I missing here???

      EDIT4: It seems that the issue is only happening on GNOME-based desktop environments like MATE (and friend reported to happen on XFCE too).

      BTW: You can check for number of opened descriptors by the process from example with this dumb bash code:

      for i in

      {1..1000000}

      ; do ls -l /proc/$(pidof traytest)/fd | wc -l; sleep 1; done

      ------

      Application uses its own https://github.com/martinrotter/rssguard/blob/master/src/librssguard/network-web/downloader.h around QNAM.
      Wrapper uses class member "QScopedPointer<SilentNetworkAccessManager> m_downloadManager" (where SilentNetworkAccessManager is subclass of QNAM).

      When any network reply finishes, is is "deleteLater()" in "finished()" signal correctly. Yet it seems that the approach somehow generates MANY non-closed files and eventually "ulimit" on Linux platform (1024) is reached and app de-facto stops working.

      EDIT: Yesterday's debugging found out, that

      QWebEngineView::setHtml("<!DOCTYPE html><html><body</body></html>", QUrl("http://rssguard.blank")));
      

      also leaks file descriptor every single time it is called.

      EDIT2: Another debugging reveals that "QSystemTrayIcon::isSystemTrayAvailable()" on Linux/X11 also leaks file descriptors EACH time it is called.

      Here is list of apps' file descriptors after some minutes of working:

      lr-x------ 1 martin martin 64 Jan  2 20:31 0 -> 'pipe:[59374]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 1 -> 'pipe:[59375]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 10 -> 'socket:[61480]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 100 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 101 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 102 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 103 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 104 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 105 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 106 -> 'socket:[61840]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 107 -> 'socket:[63582]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 108 -> 'socket:[63669]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 109 -> 'socket:[61666]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 11 -> /dev/nvidiactl
      lrwx------ 1 martin martin 64 Jan  2 20:31 110 -> '/dev/shm/.org.chromium.Chromium.FyYBQv (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 111 -> 'socket:[61737]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 112 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 113 -> 'socket:[62706]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 114 -> 'socket:[61746]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 115 -> '/dev/shm/.org.chromium.Chromium.S8n0oa (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 116 -> '/dev/shm/.org.chromium.Chromium.S8n0oa (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 117 -> '/dev/shm/.org.chromium.Chromium.W1iakz (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 118 -> '/dev/shm/.org.chromium.Chromium.W1iakz (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 119 -> '/dev/shm/.org.chromium.Chromium.ayqhKq (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 12 -> /dev/nvidia-modeset
      lrwx------ 1 martin martin 64 Jan  2 20:31 120 -> '/dev/shm/.org.chromium.Chromium.ayqhKq (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 121 -> 'socket:[51816]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 122 -> 'socket:[61756]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 123 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 124 -> 'socket:[61799]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 125 -> 'socket:[63759]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 126 -> 'socket:[63860]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 127 -> 'socket:[63245]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 128 -> 'socket:[63268]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 129 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 13 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 130 -> 'socket:[61948]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 131 -> 'socket:[63131]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 132 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:32 133 -> 'socket:[63998]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 134 -> 'socket:[63352]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 135 -> 'socket:[63355]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 136 -> 'socket:[62460]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 137 -> 'socket:[65634]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 138 -> 'socket:[64291]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 139 -> 'socket:[66611]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 14 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:32 140 -> 'socket:[64329]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 141 -> 'socket:[65000]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 142 -> 'socket:[64041]'
      lrwx------ 1 martin martin 64 Jan  2 20:32 143 -> 'socket:[64786]'
      lrwx------ 1 martin martin 64 Jan  2 20:34 144 -> 'socket:[64392]'
      lrwx------ 1 martin martin 64 Jan  2 20:34 145 -> 'socket:[67084]'
      lrwx------ 1 martin martin 64 Jan  2 20:36 146 -> 'socket:[74956]'
      lrwx------ 1 martin martin 64 Jan  2 20:41 147 -> 'socket:[75872]'
      lrwx------ 1 martin martin 64 Jan  2 20:41 149 -> 'socket:[74135]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 15 -> /home/martin/.cache/nvidia/GLCache/7282d7079a1641c44fa9957a4b3f9d51/ec687e33e1b56ec3/f0a5bccb9d694446.toc
      lrwx------ 1 martin martin 64 Jan  2 20:41 150 -> 'socket:[76864]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 16 -> /home/martin/.cache/nvidia/GLCache/7282d7079a1641c44fa9957a4b3f9d51/ec687e33e1b56ec3/f0a5bccb9d694446.bin
      lrwx------ 1 martin martin 64 Jan  2 20:31 17 -> /dev/nvidia-modeset
      lrwx------ 1 martin martin 64 Jan  2 20:31 18 -> /dev/dri/renderD128
      lrwx------ 1 martin martin 64 Jan  2 20:31 19 -> /dev/nvidia0
      l-wx------ 1 martin martin 64 Jan  2 20:31 2 -> 'pipe:[59375]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 20 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 21 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 22 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 23 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 24 -> 'socket:[51784]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 25 -> 'socket:[59379]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 26 -> /usr/share/qt/resources/qtwebengine_resources_100p.pak
      lr-x------ 1 martin martin 64 Jan  2 20:31 27 -> /usr/share/qt/resources/qtwebengine_resources_200p.pak
      lr-x------ 1 martin martin 64 Jan  2 20:31 28 -> /usr/share/qt/resources/qtwebengine_resources.pak
      lr-x------ 1 martin martin 64 Jan  2 20:31 29 -> /usr/share/qt/resources/qtwebengine_devtools_resources.pak
      lrwx------ 1 martin martin 64 Jan  2 20:31 3 -> 'socket:[51776]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 30 -> /usr/share/qt/translations/qtwebengine_locales/en-US.pak
      lrwx------ 1 martin martin 64 Jan  2 20:31 31 -> 'socket:[61489]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 32 -> 'socket:[61490]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 33 -> 'pipe:[61491]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 34 -> 'pipe:[61491]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 35 -> 'socket:[61492]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 36 -> 'socket:[61494]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 37 -> 'anon_inode:[eventpoll]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 38 -> 'pipe:[62502]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 39 -> 'pipe:[62502]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 4 -> 'anon_inode:[eventfd]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 40 -> 'pipe:[62503]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 41 -> 'pipe:[62503]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 42 -> 'anon_inode:[eventpoll]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 43 -> 'pipe:[61528]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 44 -> 'pipe:[61528]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 45 -> 'pipe:[61529]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 46 -> 'pipe:[61529]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 47 -> 'socket:[61530]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 48 -> anon_inode:inotify
      lrwx------ 1 martin martin 64 Jan  2 20:31 49 -> '/dev/shm/.org.chromium.Chromium.XvyzKc (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 5 -> 'anon_inode:[eventfd]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 50 -> '/dev/shm/.org.chromium.Chromium.XvyzKc (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 51 -> 'socket:[49728]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 52 -> /dev/nvidia-modeset
      lrwx------ 1 martin martin 64 Jan  2 20:31 53 -> 'anon_inode:[eventpoll]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 54 -> 'pipe:[62504]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 55 -> 'pipe:[62504]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 56 -> 'pipe:[62505]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 57 -> 'pipe:[62505]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 58 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 59 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 6 -> 'socket:[51778]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 60 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 61 -> /dev/nvidia0
      lrwx------ 1 martin martin 64 Jan  2 20:31 62 -> /dev/nvidia0
      lr-x------ 1 martin martin 64 Jan  2 20:31 63 -> /usr/share/icons/Papirus-Dark/icon-theme.cache
      lrwx------ 1 martin martin 64 Jan  2 20:31 64 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 65 -> 'anon_inode:[eventfd]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 66 -> 'anon_inode:[eventfd]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 67 -> 'socket:[51798]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 68 -> 'socket:[51799]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 69 -> 'anon_inode:[eventfd]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 7 -> 'socket:[51780]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 70 -> 'socket:[49733]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 71 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/Platform Notifications/LOG'
      lrwx------ 1 martin martin 64 Jan  2 20:31 72 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/Platform Notifications/LOCK'
      lrwx------ 1 martin martin 64 Jan  2 20:31 73 -> 'socket:[61539]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 74 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/Platform Notifications/000003.log'
      l-wx------ 1 martin martin 64 Jan  2 20:31 75 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/Platform Notifications/MANIFEST-000001'
      lrwx------ 1 martin martin 64 Jan  2 20:31 76 -> 'socket:[61541]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 77 -> '/dev/shm/.org.chromium.Chromium.FyYBQv (deleted)'
      lr-x------ 1 martin martin 64 Jan  2 20:31 78 -> '/dev/shm/.org.chromium.Chromium.La5ZuD (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 79 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/Visited Links'
      lrwx------ 1 martin martin 64 Jan  2 20:31 8 -> 'anon_inode:[eventfd]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 80 -> 'socket:[49734]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 81 -> '/dev/shm/.org.chromium.Chromium.La5ZuD (deleted)'
      lrwx------ 1 martin martin 64 Jan  2 20:31 82 -> 'socket:[51808]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 83 -> 'anon_inode:[eventpoll]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 84 -> 'pipe:[61641]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 85 -> 'pipe:[61641]'
      lr-x------ 1 martin martin 64 Jan  2 20:31 86 -> 'pipe:[61642]'
      l-wx------ 1 martin martin 64 Jan  2 20:31 87 -> 'pipe:[61642]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 88 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/GPUCache/index'
      lrwx------ 1 martin martin 64 Jan  2 20:31 89 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/GPUCache/data_0'
      lrwx------ 1 martin martin 64 Jan  2 20:31 9 -> 'socket:[61479]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 90 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/GPUCache/data_1'
      lrwx------ 1 martin martin 64 Jan  2 20:31 91 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/GPUCache/data_2'
      lrwx------ 1 martin martin 64 Jan  2 20:31 92 -> '/home/martin/.local/share/RSS Guard/QtWebEngine/Default/GPUCache/data_3'
      lrwx------ 1 martin martin 64 Jan  2 20:31 93 -> 'socket:[62513]'
      lrwx------ 1 martin martin 64 Jan  2 20:31 94 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 95 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 96 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 97 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 98 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      lrwx------ 1 martin martin 64 Jan  2 20:31 99 -> /mnt/data/Martin/Projekty/Moje/build-build-Desktop-Debug/src/rssguard/database/database.db*
      
      

      It seems that everytime QNAM is created and network request is made, new "socket:[XXXX]" opened file appears and is not removed at all by "runtime" although QNAM instance gets destroyed almost immediatelly via "QScopedPointer" functionality.

      I am lost.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            skunkos Martin Rotter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes