Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get intermittent Excon::Errors::SocketError: EOFError (EOFError) errors with MailChimp?

I get intermittent errors when working with the MailChimp gem from the Rails console.

Here's the error:

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>'
like image 516
James Chevalier Avatar asked Feb 20 '26 14:02

James Chevalier


2 Answers

I did a little searching on Excon::Errors::SocketError: EOFError (EOFError), and I came across this carrierwave issue, which seems to line up with my experiences.

I was able to reproduce this behavior - If I let my console sit there for a little while, then make a call to MailChimp's API, it fails once with the error above. If I retry the same call it succeeds.

So the issue seems to be caused by leaving the socket open beyond the keep-alive value. Unfortunately, I'm not aware of a fix/workaround other than "don't do that".

like image 187
James Chevalier Avatar answered Feb 22 '26 08:02

James Chevalier


Just for the record, and if someone ends up here: version 0.44.4 of excon seems to have fixed this issue. Add

gem 'excon', '~> 0.44.4'

to your Gemfile and run

bundle update excon
like image 39
Donato Azevedo Avatar answered Feb 22 '26 07:02

Donato Azevedo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!