Q: Express Error: EMFILE, too many open files I am getting the following very annoying error:
Error: EMFILE, too many open files '/home/savagegames.net/views/index.jade'
at Object.openSync (fs.js:240:18)
at Object.readFileSync (fs.js:128:15)
at View.contents (/home/savagegames.net/node_modules/express/lib/view/view.js:121:13)
at Function.compile (/home/savagegames.net/node_modules/express/lib/view.js:68:45)
at ServerResponse._render (/home/savagegames.net/node_modules/express/lib/view.js:417:18)
at ServerResponse.<anonymous> (/home/savagegames.net/node_modules/express/lib/view.js:318:17)
at /home/savagegames.net/node_modules/express-mongoose/index.js:45:21
at resolve (/home/savagegames.net/node_modules/express-mongoose/index.js:75:12)
at ServerResponse.expressmongoose [as render] (/home/savagegames.net/node_modules/express-mongoose/index.js:37:12)
at /home/savagegames.net/controllers/index_controller.coffee:49:18

I believe it is a problem with Express; how can I remedy it? Thanks.

A: From what I found, it happens when some error happens, and some files aren't closed (of course this is a bug). In my case, node-postgres errors caused (miracleously) depletion of available descriptors. When I removed the code that caused db error, the EMFILE dissapears.
I suppose it could be fixed in the node.js code - it should close file objects when garbage collecting. Though it might happen that these lost file descriptors are still locked alive by something else.

A: I went through lot of resources , but the relevant answers is in the docs of express: 
app.enable('view cache')

It really helped alot , especially lot of cache hits explains , it doesn't open the file at all.
