You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by mi...@apache.org on 2015/06/05 18:43:01 UTC

[05/11] couch-replicator commit: updated refs/heads/2707-merge-couch_replicator-fixes-from-cloudant-fork to 80708a9

Fix stream cleanup timeouts

The first part of this is adding the `after 0` clause. The issue here is
that ibrowse sends the `ibrowse_async_response_end` message without
waiting for a call to `ibrowse:stream_next/1`. This means that the
continuous changes feed may or may not get this message in
`couch_replicator_httpc:accumulate_messages/3`. If it does then we would
end up on an infinite timeout waiting for it. This was a typo in the
original patch in that I meant to include it but forgot.

The second timeout is so that we don't end up halted waiting for a
changes request to finish. If it takes longer than 30s we just crash the
replication and let the manager restart things.

BugzId: 47306

This is a cherry-pick of:

https://github.com/cloudant/couch_replicator/commit/2caf39040e4e50c38a7758d4d09e7a8b22ea92d4


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/86d77169
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/86d77169
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/86d77169

Branch: refs/heads/2707-merge-couch_replicator-fixes-from-cloudant-fork
Commit: 86d7716985d92b2d1b9a6c070a87464f917c4aa9
Parents: 8a3af42
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu May 21 10:02:53 2015 -0500
Committer: Mike Wallace <mi...@apache.org>
Committed: Fri Jun 5 17:20:26 2015 +0100

----------------------------------------------------------------------
 src/couch_replicator_httpc.erl | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/86d77169/src/couch_replicator_httpc.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc.erl b/src/couch_replicator_httpc.erl
index 544c2ef..e591601 100644
--- a/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator_httpc.erl
@@ -179,6 +179,8 @@ clean_mailbox({ibrowse_req_id, ReqId}) ->
                 {ibrowse_async_response_end, ReqId} ->
                     put(?STREAM_STATUS, ended),
                     ok
+                after 30000 ->
+                    exit({timeout, ibrowse_stream_cleanup})
             end;
         Status when Status == init; Status == ended ->
             receive
@@ -187,6 +189,8 @@ clean_mailbox({ibrowse_req_id, ReqId}) ->
                 {ibrowse_async_response_end, ReqId} ->
                     put(?STREAM_STATUS, ended),
                     ok
+                after 0 ->
+                    ok
             end
     end;
 clean_mailbox(_) ->