You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Alexander Shorin (JIRA)" <ji...@apache.org> on 2015/11/09 00:31:10 UTC

[jira] [Resolved] (COUCHDB-2833) Replicator client doesn't handle un-expectedly closed pipelined connections well

     [ https://issues.apache.org/jira/browse/COUCHDB-2833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shorin resolved COUCHDB-2833.
---------------------------------------
       Resolution: Fixed
         Assignee: Nick Vatamaniuc
    Fix Version/s: 2.0.0

> Replicator client doesn't handle un-expectedly closed pipelined connections well
> --------------------------------------------------------------------------------
>
>                 Key: COUCHDB-2833
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2833
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Replication
>            Reporter: Nick Vatamaniuc
>            Assignee: Nick Vatamaniuc
>             Fix For: 2.0.0
>
>
> This was found investigating the failure of replication tests. Specifically couch_replicator_large_atts_tests, the {local, remote} sub-case.
> The test sets up push replications from local to remote.
> Replication workers  have more than 1 document larger than MAX_BULK_ATT_SIZE=64K.  They start pushing them to the target, using a keep-alive connection (default  for HTTP 1.1), the first few pipelined requests will go through using the same connection, then server will accept the first PUT to …/docid?edits=false, then return Connection:close and close the connection after the 201 Created result.  Workers don't expect that, and try to do another PUT on same connection. And then crash on ibrowser's connection_closing error, which they don't handle. That causes the whole async replication process to exit.
> Potentially there are 2 issues.
> couch_replicator_http layer needs to handle this case better. On closing error, shut down the socket quickly and then retry. (Not shutting it down and retrying means retrying for at least 5 or so seconds until something cleans up that connection state).
> Adding this clause to couch_replicator_httpc.erl seems to do the trick:
> {code}
> process_response({error,connection_closing}, Worker, HttpDb, Params, _Cb)->
>     couch_log:notice("Connection closed by server. Closing the socket and trying again",[]),
>     ibrowse_http_client:stop(Worker),
>     throw({retry, HttpDb, Params});
> {code}
> Another issue is to make the server not close the connection after first PUT to .../db/docid?new_edits=false when using pipeline connections. See COUCHDB-2834 for more information on that issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)