summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2020-08-10 16:22:54 +0100
committerRobert Newson <robert.newson@uk.ibm.com>2020-08-12 11:37:38 +0100
commit57e35019c71f1d864b4955055a1d07e09cbf6231 (patch)
treeac16833e308879d92fc034579ff4e553ae25c516
parente0cbe1cc26552e4b96051b61a674e59012768541 (diff)
downloadcouchdb-57e35019c71f1d864b4955055a1d07e09cbf6231.tar.gz
Unlink index pid and swallow EXIT message if present
This should prevent unexpected exit messages arriving which crash couch_index_server. Patch suggested by davisp. Closes #3061.
-rw-r--r--src/couch_index/src/couch_index_server.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 49d1e61b7..67f0f8c6f 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -243,9 +243,15 @@ reset_indexes(DbName, Root) ->
end, dict:new(), ets:lookup(?BY_DB, DbName)),
Fun = fun({Sig, DDocIds}) ->
[{_, Pid}] = ets:lookup(?BY_SIG, {DbName, Sig}),
- MRef = erlang:monitor(process, Pid),
+ unlink(Pid),
gen_server:cast(Pid, delete),
- receive {'DOWN', MRef, _, _, _} -> ok end,
+ receive
+ {'EXIT', Pid, _} ->
+ ok
+ after
+ 0 ->
+ ok
+ end,
rem_from_ets(DbName, Sig, DDocIds, Pid)
end,
lists:foreach(Fun, dict:to_list(SigDDocIds)),