couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewall...@apache.org
Subject [08/13] couch-replicator commit: updated refs/heads/master to 80708a9
Date Fri, 05 Jun 2015 16:47:48 GMT
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/master
Commit: 86d7716985d92b2d1b9a6c070a87464f917c4aa9
Parents: 8a3af42
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu May 21 10:02:53 2015 -0500
Committer: Mike Wallace <mikewallace@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(_) ->


Mime
View raw message