Closed Nantris closed 1 year ago
So far I can't determine what operation I'm using that causes this. I suspect it's sort of an edge case, where I just used readdirSync
and listed 10,000 files, and then afterward some other filesystem access attempt causes the actual error.
I have never seen this occur on Linux with identical code, but it occurs without fail on Windows. My highest file reached was 9953 out of 10,000, but I can never reach 10,000.
If you're doing it synchronously, there's nothing that can be done by this module to prevent hitting the file descriptor limit. This lib works by deferring async ops until a fd closes and trying again. But sync stuff is now or never.
10k isn't that much, really, but windows is pretty restrictive sometimes.
I recommend using the directory streaming iterator API, if you have that many entries to process. You can still iterate over them synchronously.
Thanks very much for the speedy and sensible reply @isaacs. I'll investigate an alternative approach.
It always fails at around file 8300-8600. I'm on the latest version already.