Errno :: ECONNRESET:由对等方重置连接

时间:2011-11-24 05:01:18

标签: ruby-on-rails facebook error-handling passenger facebook-rest-api

我正在使用Rails应用程序和MiniFB Gem来调用Facebook Api。 我得到了以下异常

Errno::ECONNRESET:  Connection reset by peer

以下是回溯: -

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

ECONNRESET的原因是什么,facebook重置了他们的连接?还是因为与我当地的乘客有关的问题?

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。我通过将我的请求限制为1个查询/秒来以某种方式修复它。每秒有多少请求正在制作?

答案 1 :(得分:0)

尝试忽略ssl错误并增加延迟

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select name="orderedproduct" id="orderedproduct2" class="price" row='2'> <option>Select Ordered Product</option> <option value="1" data-price="45.23">incarprot</option> <option value="2" data-price="50.00">incalcy</option> </select> <input type="text" name="productqty" id="productqty2" class="gui-input txtQuantity" placeholder="Quantity" row='2'> <input type="text" name="orderammount" id="orderammount2" class="gui-input qty" disable placeholder="Total Amount"> <select name="orderedproduct" id="orderedproduct3" class="price" row='3'> <option>Select Ordered Product</option> <option value="1" data-price="45.23">incarprot</option> <option value="2" data-price="50.00">incalcy</option> </select> <input type="text" name="productqty" id="productqty3" class="gui-input txtQuantity" placeholder="Quantity" row='3'> <input type="text" name="orderammount" id="orderammount3" class="gui-input qty" disable placeholder="Total Amount"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>