{"action":"closed","issue":{"url":"https://api.github.com/repos/couchrest/couchrest/issues/87","labels_url":"https://api.github.com/repos/couchrest/couchrest/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/couchrest/couchrest/issues/87/comments","events_url":"https://api.github.com/repos/couchrest/couchrest/issues/87/events","html_url":"https://github.com/couchrest/couchrest/issues/87","id":6421326,"number":87,"title":"Problems with CouchRest hitting CouchDB through a proxy","user":{"login":"drbobbeaty","id":25190,"avatar_url":"https://avatars.githubusercontent.com/u/25190?v=3","gravatar_id":"","url":"https://api.github.com/users/drbobbeaty","html_url":"https://github.com/drbobbeaty","followers_url":"https://api.github.com/users/drbobbeaty/followers","following_url":"https://api.github.com/users/drbobbeaty/following{/other_user}","gists_url":"https://api.github.com/users/drbobbeaty/gists{/gist_id}","starred_url":"https://api.github.com/users/drbobbeaty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbobbeaty/subscriptions","organizations_url":"https://api.github.com/users/drbobbeaty/orgs","repos_url":"https://api.github.com/users/drbobbeaty/repos","events_url":"https://api.github.com/users/drbobbeaty/events{/privacy}","received_events_url":"https://api.github.com/users/drbobbeaty/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2012-08-23T22:23:40Z","updated_at":"2015-07-13T15:26:20Z","closed_at":"2015-07-13T15:26:20Z","body":"## The Set-Up\n\nWe have a simple ruby app where we allow for a proxy to be set on the CouchRest database:\n```ruby\n  def self.database\n    CouchRest.proxy(AppConfig.database.proxy_uri) if AppConfig.database.use_proxy?\n    @db ||= CouchRest.database(AppConfig.database.uri)\n  end\n```\nEverything works fine if we _don't_ use the proxy. It's when we start to use the proxy, and move **a lot** of data through the client that we get into trouble.\n\nWe're doing one at a time - not using the `bulk_save` call, if that matters at all.\n\nWe are using JRuby 1.6.7.2, again, if that matters.\n\n## The Problem\n\nWhen we're pushing about 4000 documents to the remote, proxied, CouchDB, we get about half way through the set and then get the following exception:\n\n```bash\nErrno::ECONNREFUSED: Connection refused - Connection refused\n                          initialize at org/jruby/ext/socket/RubyTCPSocket.java:121\n                                 new at org/jruby/RubyIO.java:876\n                                open at org/jruby/ext/socket/RubyTCPSocket.java:147\n                             connect at /Users/bbeaty/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/net/http.rb:644\n                             timeout at org/jruby/ext/Timeout.java:79\n                             connect at /Users/bbeaty/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/net/http.rb:644\n                            do_start at /Users/bbeaty/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/net/http.rb:637\n                               start at /Users/bbeaty/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/net/http.rb:626\n                               start at /Users/bbeaty/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/net/http.rb:625\n                            transmit at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/rest-client-1.6.7/lib/restclient/request.rb:172\n                             execute at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/rest-client-1.6.7/lib/restclient/request.rb:64\n                             execute at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/rest-client-1.6.7/lib/restclient/request.rb:33\n                             execute at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/couchrest-1.1.3/lib/couchrest/rest_api.rb:94\n                                post at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/couchrest-1.1.3/lib/couchrest/rest_api.rb:55\n                            save_doc at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/couchrest-1.1.3/lib/couchrest/database.rb:141\n                            save_doc at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/couchrest-1.1.3/lib/couchrest/database.rb:139\n                               store at /Users/bbeaty/Developer/quantum-lead/lib/database.rb:34\n                             process at /Users/bbeaty/Developer/quantum-lead/lib/quantum_lead.rb:79\n                                each at org/jruby/RubyArray.java:1615\n                             process at /Users/bbeaty/Developer/quantum-lead/lib/quantum_lead.rb:78\n              process_with_new_relic at /Users/bbeaty/Developer/quantum-lead/lib/new_relic.rb:21\n  perform_action_with_newrelic_trace at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:262\n              trace_execution_scoped at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242\n  perform_action_with_newrelic_trace at /Users/bbeaty/.rvm/gems/jruby-1.6.7.2@quantum-lead/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:257\n              process_with_new_relic at /Users/bbeaty/Developer/quantum-lead/lib/new_relic.rb:20\n                              (root) at bin/process.rb:12\n```\n\nIt _appears_ that we're getting a timeout, and then trying to reconnect and getting the 'Connection Refused'. This isn't the first send in the 4000, but it never makes it through the complete set of 4000 without this error.\n\nAny help would be **greatly** appreciated."}}