从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>'
答案 0 :(得分:8)
我在Excon::Errors::SocketError: EOFError (EOFError)
上做了一些搜索,我遇到了this carrierwave issue,这似乎符合我的经验。
我能够重现这种行为 - 如果我让我的控制台在那里停留一会儿,然后调用MailChimp的API,它会因上述错误而失败一次。如果我重试相同的呼叫,它就会成功。
所以这个问题似乎是因为套接字打开超出keep-alive值。不幸的是,除了“不要那样做”之外,我不知道修复/解决方法。
答案 1 :(得分:2)
只是为了记录,如果有人在这里结束:excon版本0.44.4似乎解决了这个问题。添加
gem 'excon', '~> 0.44.4'
到您的Gemfile并运行
bundle update excon