From 03f2f1f5b5822fe3bba9602a38ab58addbf24a56 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Tue, 18 Jun 2024 17:13:04 +0100 Subject: [PATCH] don't crash nouveau_index_updater for any DOWN Reason Hard to induce in a unit test but under stress it is possible to get back Reason's like `{timeout, {gen_server, call, ...` among others. Pass these along to the client processes and do not crash the manager. --- src/nouveau/src/nouveau_index_manager.erl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nouveau/src/nouveau_index_manager.erl b/src/nouveau/src/nouveau_index_manager.erl index 92135f10e41..eb18bc6f7fe 100644 --- a/src/nouveau/src/nouveau_index_manager.erl +++ b/src/nouveau/src/nouveau_index_manager.erl @@ -91,10 +91,8 @@ handle_info({'DOWN', IndexerRef, process, _Pid, Reason}, State) -> true = ets:delete(?BY_REF, IndexerRef), [{_, Index, Queue0}] = ets:lookup(?BY_DBSIG, DbSig), {{value, From}, Queue1} = queue:out(Queue0), - case Reason of - ok -> - gen_server:reply(From, ok); - {error, Msg} -> + if + Reason /= ok -> couch_log:error( "~p: db:~s ddoc:~s index:~s failed with: ~p", [ @@ -102,11 +100,13 @@ handle_info({'DOWN', IndexerRef, process, _Pid, Reason}, State) -> mem3:dbname(Index#index.dbname), Index#index.ddoc_id, Index#index.name, - Msg + Reason ] - ), - gen_server:reply(From, {error, Msg}) + ); + true -> + ok end, + gen_server:reply(From, Reason), case queue:is_empty(Queue1) of true -> true = ets:delete(?BY_DBSIG, DbSig);