How do I run the test suite for actioncable? I'm getting an Errno::EMFILE error

Hi there,

I’m trying to make a small contribution to actioncable, but before I do that, I wanted to make sure that the test suite for actioncable is passing in master.

I’m trying to run the test suite at Remove config class attribute from TestFixtures · rails/rails@f22dd39 · GitHub but I keep getting this error:

Error:
ClientTest#test_many_clients:
Errno::EMFILE: Too many open files - socket(2) for "127.0.0.1" port 3099
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/bundler/gems/websocket-client-simple-e161305f1a46/lib/websocket-client-simple/client.rb:20:in `initialize'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/bundler/gems/websocket-client-simple-e161305f1a46/lib/websocket-client-simple/client.rb:20:in `new'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/bundler/gems/websocket-client-simple-e161305f1a46/lib/websocket-client-simple/client.rb:20:in `connect'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/bundler/gems/websocket-client-simple-e161305f1a46/lib/websocket-client-simple/client.rb:8:in `connect'
    /Users/etagwerker/Projects/fastruby/rails/actioncable/test/client_test.rb:113:in `initialize'
    /Users/etagwerker/Projects/fastruby/rails/actioncable/test/client_test.rb:200:in `new'
    /Users/etagwerker/Projects/fastruby/rails/actioncable/test/client_test.rb:200:in `websocket_client'
    /Users/etagwerker/Projects/fastruby/rails/actioncable/test/client_test.rb:244:in `block (2 levels) in test_many_clients'
    /Users/etagwerker/Projects/fastruby/rails/actioncable/test/client_test.rb:204:in `block (2 levels) in concurrently'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `block in synchronize'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/ivar.rb:169:in `safe_execute'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/future.rb:55:in `block in execute'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:353:in `run_task'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:342:in `block (3 levels) in create_worker'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:325:in `loop'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:325:in `block (2 levels) in create_worker'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:324:in `catch'
    /Users/etagwerker/.rvm/gems/ruby-2.5.7/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:324:in `block in create_worker'

Here is the entire output: rake test for actioncable failure · GitHub

Here is my ruby version:

$ ruby --version
ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-darwin19]

Here is my bundle env: gist:134f0f96a45ca751aa8a489dce31c868 · GitHub

I see that the tests pass in Buildkite (Rails #71183), so I’m quite certain that there is something wrong with my environment.

Any thoughts?

Thanks in advance! :slight_smile:

1 Like

I suggest googling of “Too many open files”. There’s a limitation that you can check with ulimit (or depending on your OS). It’s possible to increase this limit.

@phil_pirozhkov Good point. My ulimit was set to 256.

I bumped that limit to 524288 by following the instructions in this blog post: “Too many open files” limit/ulimit on Mac OS X | by Thomas Jung | Mindful Technology | Medium

Now the test passes as expected. :+1:

Thank you!