0

I get this error right after precompiling the assets in the capistrano deploy script:

Excon::Error::Socket: Too many open files - getaddrinfo (Errno::EMFILE)
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/socket.rb:101:in `getaddrinfo’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/socket.rb:101:in `connect’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/ssl_socket.rb:153:in `connect’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/socket.rb:29:in `initialize’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/ssl_socket.rb:9:in `initialize’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:403:in `new’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:403:in `socket’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:100:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/mock.rb:48:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/instrumentor.rb:26:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:16:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:16:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:16:in `request_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:249:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/idempotent.rb:27:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:272:in `rescue in request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:215:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/idempotent.rb:27:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:272:in `rescue in request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:215:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/idempotent.rb:27:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/middlewares/base.rb:11:in `error_call’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:272:in `rescue in request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/excon-0.55.0/lib/excon/connection.rb:215:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-core-1.43.0/lib/fog/core/connection.rb:81:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-xml-0.1.2/lib/fog/xml/connection.rb:9:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-aws-1.2.1/lib/fog/aws/storage.rb:612:in `_request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-aws-1.2.1/lib/fog/aws/storage.rb:607:in `request’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-aws-1.2.1/lib/fog/aws/requests/storage/put_object.rb:47:in `put_object’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-aws-1.2.1/lib/fog/aws/models/storage/file.rb:219:in `save’
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/fog-core-1.43.0/lib/fog/core/collection.rb:51:in `create’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/storage.rb:208:in `upload_file’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/storage.rb:221:in `block in upload_files’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/storage.rb:219:in `each’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/storage.rb:219:in `upload_files’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/storage.rb:235:in `sync’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/asset_sync.rb:29:in `block in sync’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/asset_sync.rb:51:in `with_config’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/asset_sync/asset_sync.rb:28:in `sync’
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/tasks/asset_sync.rake:5:in `block (2 levels) in <top (required)>'
/home/deployer/au/shared/bundle/ruby/2.4.0/bundler/gems/asset_sync-5d3f776ff2eb/lib/tasks/asset_sync.rake:29:in `block in <top (required)>'
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/webpacker-1.2/lib/tasks/webpacker/compile.rake:40:in `block in <top (required)>'
/home/deployer/au/shared/bundle/ruby/2.4.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/home/deployer/.rbenv/versions/2.4.0/bin/bundle:22:in `load’
/home/deployer/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'

I can see that asset_sync gem is invoked and it is trying to upload files to s3. This problem started a day ago, and we have not increased the number of files that should be uploaded to s3.

What could we do to limit the scope when debugging this? Can we rule out something, by looking at this log output? Is it this specific process (the precompile rake task) that is opening too many files?

How can we debug what files are open by the process at the moment this error occurs?

Cristian
  • 5,877
  • 6
  • 46
  • 55
  • there is option in ubuntu `ulimit` https://ss64.com/bash/ulimit.html maybe, it helps you – Alexey Jun 22 '17 at 11:38
  • I added an issue to the asset_sync gem which we believe was the culprit of the error: https://github.com/AssetSync/asset_sync/issues/348 – Cristian Jun 22 '17 at 18:30

0 Answers0