我正在使用ejs-local为我的node.js应用程序呈现视图。我看到很多打开的文件“渲染视图时出现异常:
Error: EMFILE, too many open files '/home/user/app/views/index.html'
at Object.fs.openSync (fs.js:432:18)
at fs.readFileSync (fs.js:289:15)
at Object.exports.renderFile (/home/wangchen/bweb_auto/node_modules/ejs-locals/node_modules/ejs/lib/ejs.js:313:9)
at View.module.exports [as engine] (/home/user/app/node_modules/ejs-locals/index.js:85:7)
at View.render (/home/user/app/node_modules/express/lib/view.js:76:8)
at Function.app.render (/home/user/app/node_modules/express/lib/application.js:506:10)
at ServerResponse.res.render (/home/user/app/node_modules/express/lib/response.js:759:7)
at /home/user/app/routes/index.js:226:17
at Query._callback (/home/user/app/node_modules/orm/lib/ChainFind.js:190:13)
at Query.Sequence.end (//home/user/appode_modules/mysql/lib/protocol/sequences/Sequence.js:75:24)
拆掉整个网站。虽然看似添加ulimit可能会解决这个问题:它的当前设置为1024.我更关心ejs代码/节点中可能存在的错误,它在必要时没有关闭文件。 你有类似的事吗?