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 2020/08/10 16:25:20 UTC

[couchdb] branch couch_index_server_crash created (now 20d8f60)

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

rnewson pushed a change to branch couch_index_server_crash
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 20d8f60  Unlink index pid and swallow EXIT message if present

This branch includes the following new commits:

     new 20d8f60  Unlink index pid and swallow EXIT message if present

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Unlink index pid and swallow EXIT message if present

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch couch_index_server_crash
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 20d8f6028979d0ff4c26b42636ddd792ff5e8f7b
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Aug 10 16:22:54 2020 +0100

    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.
---
 src/couch_index/src/couch_index_server.erl | 10 ++++++++--
 1 file 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 49d1e61..67f0f8c 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)),