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:41:29 +0100
commit90cd1ef8b24ccb23a1d873cad903adeeffa6870a (patch)
tree8777196648de95b99ec09d3e6e99716562810a75
parent625698d86fa366af490c27d6641cad313d65b97a (diff)
downloadcouchdb-90cd1ef8b24ccb23a1d873cad903adeeffa6870a.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)),