ruby-on-rails – 为什么我在MailChimp中出现间歇性的Excon :: Errors :: SocketError:EOFError(EOFError)错误?

从Rails控制台使用MailChimp gem时,我会出现间歇性错误.

这是错误:

Excon::Errors::SocketError: EOFError (EOFError)
  from /Users/me/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/openssl/buffering.rb:246:in `readline'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/excon-0.26.0/lib/excon/response.rb:39:in `parse'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/excon-0.26.0/lib/excon/middlewares/response_parser.rb:6:in `response_call'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/excon-0.26.0/lib/excon/connection.rb:349:in `response'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/excon-0.26.0/lib/excon/connection.rb:252:in `request'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/excon-0.26.0/lib/excon/connection.rb:290:in `post'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/mailchimp-api-2.0.3/lib/mailchimp.rb:40:in `call'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/mailchimp-api-2.0.3/lib/mailchimp/api.rb:861:in `member_info'
  from (irb):5
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
  from /Users/me/.rvm/gems/ruby-1.9.3-p448@launchsoon/gems/railties-3.2.14/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'
最佳答案
我在Excon :: Errors :: SocketError:EOFError(EOFError)上做了一些搜索,我遇到了this carrierwave issue,这似乎符合我的经验.

我能够重现这种行为 – 如果我让我的控制台在那里停留一会儿,然后调用MailChimp的API,它会因上述错误而失败一次.如果我重试相同的呼叫,它就会成功.

所以问题似乎是由于套接字保持打开超出保持活动值而引起的.不幸的是,除了“不要那样做”之外,我不知道修复/解决方法.

转载注明原文:ruby-on-rails – 为什么我在MailChimp中出现间歇性的Excon :: Errors :: SocketError:EOFError(EOFError)错误? - 代码日志