-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMFILE when using StaticAssets with a lot of files. #94
Comments
@chakrit I just ran your test, and I didn't get the error. I would try upping the number of open file handles on your system.
In general, asset-rack is not designed for "large" numbers of static assets as it holds everything in memory. |
@techpines would you accept a graceful-fs patch then? I think the problem might be that it is opening too many files too quickly during initialization to load things in memory. |
I think so, as long as it didn't break anything. |
Since this module always deal with lots and lots of static files I believe it is a good idea to add a central point where all fs calls can be traced/inspect/modifed/patched/whatever. In this commit I'm simply replacing all `require 'fs'` found in the codebase with require `require './fs.coffee' which now simply exports the `graceful-fs` module. This is to combat the EMFILE issue: techpines#94
I have made a test repository for this: https://github.com/chakrit/rack-emfile-issue It basically includes:
Basically, StaticAssets cannot seem to handle EMFILE well. Running
node test.js
result in this:A bit of googling leads me to https://github.com/isaacs/node-graceful-fs but not sure it'd be as simple as replacing all
fs
withgraceful-fs
. This is blocking me from working on one of my websites.Will check up on the codebase and make a PR if I have time but if you can take a look at this I'd greatly appreciate it.
node --version
isv0.10.17
and I'm on OS X ML.The text was updated successfully, but these errors were encountered: