Closed m-burhan closed 13 years ago
Based on the exception, the connection is going away before it finishes sending the request.
Does this happen every time, or intermittently?
that happens sporadically.
I think we just need to catch this exception and retry (in https://github.com/chicks/sugarcrm/blob/master/lib/sugarcrm/connection/connection.rb)
I'll try to patch and test/release this this weekend.
I'm getting the same error. Any time line on the fix?
Fixed. Can you update to 0.9.16 and let me know if you run into any additional issues?
This is what happened once:
Exiting
/Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection/connection.rb:75:in send!': SugarCRM::Connection Errors: (SugarCRM::RetryLimitExceeded) execution expired execution expired execution expired from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection/connection.rb:89:in
send!'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection/api/login.rb:16:in login' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection/connection.rb:45:in
login!'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection/connection.rb:33:in initialize' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:115:in
new'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:115:in new_connection' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:121:in
checkout_new_connection'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:61:in checkout' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:57:in
loop'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:57:in checkout' from /Users/sultanbhatia/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in
synchronize'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:56:in checkout' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/connection_pool.rb:41:in
connection'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/session.rb:95:in connection' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/module.rb:138:in
register_all'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/session.rb:68:in connect' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/session.rb:19:in
initialize'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/session.rb:35:in new' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/bundler/gems/sugarcrm-ee48a4d4c53d/lib/sugarcrm/session.rb:35:in
from_hash'
from /Users/sultanbhatia/mobisoft/config/initializers/sugarcrm.rb:5
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in load' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in
load'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in
new_constants_in'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in
load'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/engine.rb:201
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/engine.rb:200:in each' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/engine.rb:200 from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/initializable.rb:25:in
instance_exec'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/initializable.rb:25:in run' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/initializable.rb:50:in
run_initializers'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/initializable.rb:49:in each' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/initializable.rb:49:in
run_initializers'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/application.rb:134:in initialize!' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/application.rb:77:in
send'
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/railties-3.0.0/lib/rails/application.rb:77:in method_missing' from /Users/sultanbhatia/mobisoft/config/environment.rb:5 from /Users/sultanbhatia/mobisoft/config.ru:3:in
require'
from /Users/sultanbhatia/mobisoft/config.ru:3
from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/rack-1.2.3/lib/rack/builder.rb:46:in instance_eval' from /Users/sultanbhatia/.rvm/gems/ruby-1.8.7-p174@mobisoft-r187p174r300/gems/rack-1.2.3/lib/rack/builder.rb:46:in
initialize'
from /Users/sultanbhatia/mobisoft/config.ru:1:in `new'
from /Users/sultanbhatia/mobisoft/config.ru:1
That means the gem tried to send the request three times and failed. Each failure is an "execution expired" error, which indicates the server took too long to respond (according to the client). You can adjust how long the gem will wait before throwing this error with:
SugarCRM.connection.connection.read_timeout
You also might consider structuring your API calls so that they return faster, or handle smaller amounts of data.
Setting SugarCRM.connection.connection.read_timeout seems to have solved the problem. Thanks.
Awesome!
Hi -
I am using below code to confirm existence of a contact from sugarcrm when contact's email is matched
sc_contacts = SugarCRM.connection.get_entry_list( "Contacts", "contacts.id IN (SELECT bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (eabr.email_address_id = ea.id) WHERE bean_module = 'Contacts' AND ea.email_address_caps LIKE '#{subscriber_info["email"].upcase}' AND eabr.deleted=0)" )
at this line of code below exception is raised, any thoughts on it?
/usr/local/lib/ruby/1.9.1/net/protocol.rb:191:in
write' /usr/local/lib/ruby/1.9.1/net/protocol.rb:191:in
write0' /usr/local/lib/ruby/1.9.1/net/protocol.rb:167:inblock in write' /usr/local/lib/ruby/1.9.1/net/protocol.rb:182:in
writing' /usr/local/lib/ruby/1.9.1/net/protocol.rb:166:inwrite' /usr/local/lib/ruby/1.9.1/net/http.rb:1739:in
send_request_with_body' /usr/local/lib/ruby/1.9.1/net/http.rb:1724:inexec' /usr/local/lib/ruby/1.9.1/net/http.rb:1189:in
transport_request' /usr/local/lib/ruby/1.9.1/net/http.rb:1177:inrequest' /usr/local/lib/ruby/1.9.1/net/http.rb:978:in
post' /usr/local/lib/ruby/gems/1.9.1/gems/sugarcrm-0.9.15/lib/sugarcrm/connection/connection.rb:75:insend!' /usr/local/lib/ruby/gems/1.9.1/gems/sugarcrm-0.9.15/lib/sugarcrm/connection/api/get_entry_list.rb:29:in
get_entry_list' /var/www/sync_contacts/service/sync_contacts.rb:572:inblock in get_sugar_contact' /var/www/sync_contacts/service/sync_contacts.rb:570:in
each' /var/www/sync_contacts/service/sync_contacts.rb:570:inget_sugar_contact' /var/www/sync_contacts/service/service.rb:138:in
block in class:Service' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1152:incall' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1152:in
block in compile!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:ininstance_eval' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:in
route_eval' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:708:inblock (2 levels) in route!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:758:in
block in process_route' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:incatch' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:in
process_route' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:707:inblock in route!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:in
each' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:inroute!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:843:in
dispatch!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:inblock in call!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in
instance_eval' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:inblock in invoke' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in
catch' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:ininvoke' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:in
call!' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:629:incall' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/head.rb:9:in
call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/commonlogger.rb:20:incall' /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.2.6/lib/sinatra/showexceptions.rb:21:in
call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/methodoverride.rb:24:incall' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/showexceptions.rb:24:in
call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/lint.rb:48:in_call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/lint.rb:36:in
call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/showexceptions.rb:24:incall' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/commonlogger.rb:20:in
call' /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:518:inprocess_client' /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:585:in
worker_loop' /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:475:inspawn_missing_workers' /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:135:in
start' /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn:121:in `<top (required)>'