You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2024/06/18 16:14:44 UTC

(couchdb) 01/01: don't crash nouveau_index_updater for any DOWN Reason

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch nouveau-manager-crash-fix
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 847974678681dbf3e093f67dd57b0ca5c6d507a5
Author: Robert Newson <Ro...@ibm.com>
AuthorDate: Tue Jun 18 17:13:04 2024 +0100

    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 92135f10e..13cba39bf 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);