Ruby: Too many @rb_sysopen open files

After opening the file with File.new(big_file)(without closing it) 1016 times (Ubuntu) or 1017 times (CentOS), it seems that there is a limit, and it raises:

Too many open files @ rb_sysopen - big_file (Errno::EMFILE)

Is there a way to raise this limit?

On my systems is ulimitinstalled on unlimited.

+4
source share
1 answer
  • EMFILE - Too many files open in your process.
  • ENFILE - Too many files open throughout the system.

So, Errno::EMFILEdue to the fact that the ruby ​​process opens too many files. This limit is probably set to the default value 1024, which can be seen with:

$ulimit -n
1024

Instead:

$ulimit
unlimited

You can increase the limit using this method .

+5

Source: https://habr.com/ru/post/1660720/


All Articles