2

我只是升级到 ruby​​ 2.3 以利用 freeze_string_literal 选项,但它Errno::EMFILE: Too many open files在生产中产生了错误。

当我降级到 ruby​​ 2.2.3 时,不再出现错误。

这是我拥有的 ruby​​ 2.3 错误调用跟踪之一:

Errno::EMFILE: Too many open files - socket(2) for "XX.XXX.XX.XXX" port 9200 (XX.XXX.XX.XXX:9200)
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `initialize'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `new'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:597:in `create_socket'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:742:in `block in connect'
/.../.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
/.../.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:735:in `connect'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:497:in `query'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient/session.rb:170:in `query'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient.rb:1238:in `do_get_block'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient.rb:1021:in `block in do_request'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient.rb:1129:in `protect_keep_alive_disconnected'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient.rb:1016:in `do_request'
/.../production/shared/bundle/ruby/2.3.0/gems/httpclient-2.7.1/lib/httpclient.rb:858:in `request'
/.../production/shared/bundle/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/httpclient.rb:36:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
/.../production/shared/bundle/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-ruby-a5ed3f6aa679/elasticsearch-transport/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-ruby-a5ed3f6aa679/elasticsearch-transport/lib/elasticsearch/transport/transport/base.rb:201:in `perform_request'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-ruby-a5ed3f6aa679/elasticsearch-transport/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-ruby-a5ed3f6aa679/elasticsearch-transport/lib/elasticsearch/transport/client.rb:125:in `perform_request'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-ruby-a5ed3f6aa679/elasticsearch-api/lib/elasticsearch/api/actions/index.rb:99:in `index'
/.../production/shared/bundle/ruby/2.3.0/bundler/gems/elasticsearch-rails-489ab24998a8/elasticsearch-model/lib/elasticsearch/model/indexing.rb:336:in `index_document'
/.../production/releases/20160128001123/app/models/concerns/elastic_search/searchable.rb:12:in `block (3 levels) in '
/.../production/releases/20160128001123/app/jobs/elasticsearch_job.rb:9:in `perform'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/execution.rb:32:in `block in perform_now'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:342:in `block in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/translation.rb:7:in `block (2 levels) in '
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:342:in `block in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/logging.rb:23:in `block (4 levels) in '
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `block in instrument'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `instrument'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/logging.rb:22:in `block (3 levels) in '
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/logging.rb:43:in `block in tag_logger'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `tagged'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/logging.rb:43:in `tag_logger'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/logging.rb:19:in `block (2 levels) in '
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:342:in `block in simple'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in `block in around'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
/.../production/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/execution.rb:31:in `perform_now'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/execution.rb:21:in `execute'
/.../production/shared/bundle/ruby/2.3.0/gems/activejob-4.2.5.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:42:in `perform'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/processor.rb:80:in `execute_job'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/processor.rb:56:in `block (2 levels) in process'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-failures-0.4.5/lib/sidekiq/failures/middleware.rb:9:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/logging.rb:30:in `with_context'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/processor.rb:51:in `block in process'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/processor.rb:104:in `stats'
/.../production/shared/bundle/ruby/2.3.0/gems/sidekiq-3.5.4/lib/sidekiq/processor.rb:50:in `process'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28:in `public_send'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28:in `dispatch'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/call/async.rb:7:in `dispatch'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/cell.rb:50:in `block in dispatch'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/cell.rb:76:in `block in task'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339:in `block in task'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/task.rb:44:in `block in initialize'
/.../production/shared/bundle/ruby/2.3.0/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14:in `block in create'

我在 ruby​​ 错误跟踪器和 stackoverflow 上都没有找到有这种担忧的人,而且 ruby​​ 2.3 是最近的(<2 个月)。

我该如何处理?

4

0 回答 0