You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/10/02 17:24:50 UTC
couch-replicator commit: updated refs/heads/master to 85d62d1
Repository: couchdb-couch-replicator
Updated Branches:
refs/heads/master 73139f0eb -> 85d62d1e2
Handle un-expected closing of pipelined connections better.
If during a pipelined connection, server closes its socket,
but http client has more requests to send, ibrowse will
detect that when it sends next request and throw
{error, connection_closing}.
Handle that error better, by closing the socket explicitly
and retrying the pipelined request that failed.
COUCHDB-2833
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/85d62d1e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/85d62d1e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/85d62d1e
Branch: refs/heads/master
Commit: 85d62d1e2b72250c329b4b10db4df1231e647933
Parents: 73139f0
Author: Nick Vatamaniuc <va...@gmail.com>
Authored: Fri Oct 2 09:55:42 2015 -0400
Committer: Nick Vatamaniuc <va...@gmail.com>
Committed: Fri Oct 2 10:03:24 2015 -0400
----------------------------------------------------------------------
src/couch_replicator_httpc.erl | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/85d62d1e/src/couch_replicator_httpc.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc.erl b/src/couch_replicator_httpc.erl
index 9a10bdb..8b34e0e 100644
--- a/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator_httpc.erl
@@ -106,6 +106,14 @@ send_ibrowse_req(#httpdb{headers = BaseHeaders} = HttpDb, Params) ->
process_response({error, sel_conn_closed}, _Worker, HttpDb, Params, _Cb) ->
throw({retry, HttpDb, Params});
+%% This clause handles un-expected connection closing during pipelined requests.
+%% For example, if server responds to a request, sets Connection: close header
+%% and closes the socket, ibrowse will detect that error when it sends
+%% next request.
+process_response({error, connection_closing}, Worker, HttpDb, Params, _Cb)->
+ ibrowse_http_client:stop(Worker),
+ throw({retry, HttpDb, Params});
+
process_response({error, {'EXIT',{normal,_}}}, _Worker, HttpDb, Params, _Cb) ->
% ibrowse worker terminated because remote peer closed the socket
% -> not an error