My system has been collecting huge amounts of file handles, including those used by crucial system files such as \SystemRoot\system32\ntoskrnl.exe and explorer.exe , which were utilizing over 10 million+ file handles. At one point, my system’s total number of file handles had reached approximately 70 million. That is when I decided to investigate further.
This issue has been ongoing for some time, but it hasn’t been a priority. I only investigated it recently. After looking into it, I discovered that the Nextcloud Desktop sync app might be the cause because closing the Nextcloud app appears to resolve the problem and prevent new handles from being added by other apps.
I think something fishy going on here with file handling.
I used Process Hacker and Process Explorer to check the number of handles on the processes. They both showed me total number of handles in the system per process.
I use the desktop app to sync some folders under a single account. There are around 40k files / 3k folders in the sync. I don’t use VFS.
It seems to me that one of the main culprit might be the Nextcloud explorer integration. I am not a Windows developer, so I could only go with the surface details.
I disabled all the explorer integrations, both in the app and in the context menus etc using ShellExView. I restarted the app and I don’t see a massive number of handles anymore. Bear in mind that this has been an issue for me for many weeks (maybe even more, that was when I saw the issue), I did many system restarts then. It is very suspicious that the issue would go away after I disabled all the explorer integrations, at least for now.
As I mentioned shutting down the desktop app stopped the issue right away, so that was the other clue.
My system now has around total of 110k+/- handles steady since I disabled the integrations. It goes up and down but it never goes up to millions as time goes by anymore.
I don’t have the exact same issue but I had problems with IO and other things because some apps complained that “too many files/handles” (like 70 million handle) were open.
One of my concerns was that the NC desktop app was opening files and closing them without releasing the file handles. I didn’t spend a lot of time investigating this issue since my main priority was to resolve the problem affecting system stability.
What caught my attention, however, were the logs generated by the desktop app, which appeared very frequently in the system logs. The number of active file handles tended to increase at a rate of roughly 5 handles per second, particularly by Explorer.exe. This rapid accumulation of file handles would add up to nearly half a million handles over the course of just one day which explains why at some point my system was getting close to 70 million open handles.
Here is a recording I did earlier, as you see the number was going up steadily.