Skip to content

Instantly share code, notes, and snippets.

@mironal
Created November 7, 2017 08:06
Show Gist options
  • Select an option

  • Save mironal/cb5dbd361d58fb487361834e60e7e2a0 to your computer and use it in GitHub Desktop.

Select an option

Save mironal/cb5dbd361d58fb487361834e60e7e2a0 to your computer and use it in GitHub Desktop.
A test to generate "Too many open files" error.
#test_fd.rb:4:in `initialize': Too many open files in system @ rb_sysopen - 5053.test (Errno::ENFILE)
files = []
1.step do |i|
file = File.open("#{i}.test", "w")
files << file
puts "#{i} => fileno: #{file.fileno}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment