title: Errno::ECONNRESET: Connection reset by peer
body: <p>I am using Rails application and MiniFB Gem to call Facebook Api. 
  I got following exception </p>
  
  <pre><code>Errno::ECONNRESET:  Connection reset by peer
  </code></pre>
  
  <p>And following is the backtrace:-</p>
  
  <pre><code>Backtrace :
  /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
  /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
  /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
  /usr/lib/ruby/1.8/net/http.rb:542:in `start'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rest-client-1.6.1/lib/restclient.rb:68:in `get'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/mini_fb-1.1.7/lib/mini_fb.rb:633:in `fetch'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/mini_fb-1.1.7/lib/mini_fb.rb:619:in `rest'
  /usr/local/share/webapps/airtelfbvoiceupdates/lib/facebook.rb:39:in `getContactInfo'
  /usr/local/share/webapps/airtelfbvoiceupdates/app/models/person.rb:453:in `probe_email_in_facebook'
  /usr/local/share/webapps/airtelfbvoiceupdates/app/controllers/api/ussd_controller.rb:45:in `index'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in `send'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:617:in `call_filters'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:10:in `realtime'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:in `perform_action'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `send'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `process_without_filters'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in `process'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in `process'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:87:in `dispatch'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in `_call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
  /usr/local/share/webapps/airtelfbvoiceupdates/vendor/bundle/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:106:in `call'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/utils.rb:252:in `safe_fork'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:163:in `start'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/bin/passenger-spawn-server:61
  </code></pre>
  
  <p>What can be the reason for ECONNRESET, did facebook reset their connection ? or was it due to something related to my local Passenger related issue?</p>