use graceful-fs in place of fs to fix emfile errors#570
Conversation
|
Ah cool! I had looked at this but didn't realize you could do a global patch on fs. This looks good to me. |
|
+1 on the rationale for using graceful-fs. Did we determine that the |
No, it's watching too many files with chokidar. But this has a global fs patch too. I think that means it'll use that in chokidar? gracefulFs.gracefulify(realFs) |
|
Yes, @joehand you're right. It's monkey patching chokadir. |
|
Jfyi, I was getting this error with my test case of seeding only one big file (ubuntu install image) in a folder. |
@beingalink Ya, that is another bug we know about. But EMIFILE error will be an issue regardless, may as well fix it now =). |
This aims to fix #524 with EMFILE errors if ulimit is set to below 2048.
In chokidar, they use
fsinstead ofgraceful-fs. There are issues discussing this and the maintainers still use regularfsdespite many folks asking them to usegraceful-fsinstead to avoid EMFILE errors.The case for keeping
fsinstead ofgraceful-fsinchokidaris this:''I don't think it will make sense to switch all of chokidar to graceful-fs because it creates a risk of locking up the program in certain watch modes that hold open too many file descriptors, as described above. In this case it seems better to let the EMFILE happen, resulting in the user educating themselves about ulimit, etc. I considered sniffing for it and printing a console.warn or something like that to tell end-users about the ulimit thing, but I don't think the maintainers of the dependents of chokidar would appreciate it polluting the stderr of their apps.''
However, we won't have that problem, because we are closing file descriptors as we go. See paulmillr/chokidar#141 (comment): 'graceful-fs will be very bad if you are opening and keeping open a lot of file descriptors'
I feel confident using graceful-fs and then closing #524