节点posix setrlimit崩溃,EINVAL – 无效的参数

以下coed给了我一个EINVAL错误和节点崩溃:

var posix = require('posix'); console.log(posix.getrlimit('nofile')); posix.setrlimit('nofile', {soft: 10000}); ERROR: /var/myfil/index.js:19 posix.setrlimit('nofile', {soft: 10000}); ^ Error: EINVAL, Invalid argument at Object.<anonymous> (/var/myfile/index.js:19:7) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) 

问题是什么? 这就像文件。

如果您尝试设置高于硬限制的软限制,则会发生这种情况。

尝试设置它们两个:

 posix.setrlimit('nofile', { soft: 10000, hard: 10000 });