Large number of files missing from Nextcloud folder after "too many open files" error

About an hour ago I suddenly experienced a strange issue on my mac running macOS 10.14.4 where a number of apps started failing with the error “too many open files”. At the time I didn’t think I was doing anything particularly unusual, and am not sure what caused this situation to occur.

However, after it cleared up, I was shocked to discover that a huge number of files from my Nextcloud folder were missing. I can only presume that this “too many open files” error that was occurring system-wide caused Nextcloud to fail to write files to disk, causing them to be silently deleted.

Fortunately they still exist in my Nextcloud server and can be found in the web UI. And I have a Time Machine backup on my mac which I’m using to restore the last backed up version of my Nextcloud folder so that I don’t need to re-sync 9 GB of data.

However, I’m concerned that Nextcloud could have been the culprit here. Is it possible it had too many open file handles? I’ve never experienced that problem before in the 16 years I’ve been using macOS / OS X / Mac OS X, and I only just recently started using Nextcloud a few weeks ago.

Regardless, I feel that it failing to open files due to a “too many open files” error should not result in dataloss like it did, and that this may be a severe bug in Nextcloud’s desktop client.

Does anyone else agree?

Perhaps I should make a bug report in the nextcloud/desktop issue tracker on github?

Is there anything else I can do to prevent this from happening again?

Quick update: I have discovered that the cause of the “too many open files” error was not Nextcloud. Another application (AnyDesk) was changing the maximum number of files that can be open from “unlimited” to 10280 for some bizarre reason.

I’ll make a bug report to Nextcloud’s github page about the dataloss that occurred as a result of this. Obviously this is an uncommon and broken situation, but I do believe it shouldn’t result in dataloss.

I solved this problem for me by adding the following line to the config.php file of the Nextcloud server :
'bulkupload.enabled' => false,
I have experienced this problem on several servers with different configuration and Nextcloud version 25.0.2.
The function is an optimization for small files, but the server still work pretty fast.