Skip to content

Commit

Permalink
MB-11458 upr client should crash if any fatal errors happen
Browse files Browse the repository at this point in the history
upr client should not supress any erlang process crash that is happening
to the receive worker and try restarting receive worker. The receive
worker process should be restarted only if the upr connection is dropped.

Change-Id: I3815247c9981dfeb9af51deced0ac1dffda05257
Reviewed-on: http://review.couchbase.org/38470
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: buildbot <build@couchbase.com>
  • Loading branch information
t3rm1n4l committed Jun 19, 2014
1 parent b6625b7 commit 6b4f3a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/couch_upr/src/couch_upr_client.erl
Expand Up @@ -473,10 +473,15 @@ handle_info({stream_event, RequestId, Event}, State) ->
{noreply, State}
end;

handle_info({'EXIT', Pid, _Reason}, #state{worker_pid = Pid} = State) ->
handle_info({'EXIT', Pid, {conn_error, Reason}}, #state{worker_pid = Pid} = State) ->
?LOG_ERROR("upr client (~p): upr receive worker failed due to reason: ~p."
" Restarting upr receive worker...", [self(), Reason]),
timer:sleep(?UPR_RETRY_TIMEOUT),
restart_worker(State);

handle_info({'EXIT', Pid, Reason}, #state{worker_pid = Pid} = State) ->
{stop, Reason, State};

handle_info({print_log, Pid, ReqId}, State) ->
#state{
active_streams = ActiveStreams
Expand Down Expand Up @@ -1056,7 +1061,7 @@ receive_worker(Socket, Timeout, Parent, MsgAcc0) ->
receive_worker(Socket, Timeout, Parent, MsgAcc)
end;
{error, Reason} ->
Reason
exit({conn_error, Reason})
end.

% Check if we need to send buffer ack to server and send it
Expand Down

0 comments on commit 6b4f3a8

Please sign in to comment.