davisp commented on a change in pull request #1182: fixed race is_idle
URL: https://github.com/apache/couchdb/pull/1182#discussion_r170677435
 
 

 ##########
 File path: src/couch/src/couch_db.erl
 ##########
 @@ -200,7 +200,12 @@ reopen(#db{main_pid = Pid, fd = Fd, fd_monitor = OldRef, 
user_ctx = UserCtx}) ->
 
 incref(#db{fd = Fd} = Db) ->
     Ref = erlang:monitor(process, Fd),
-    {ok, Db#db{fd_monitor = Ref}}.
+    receive
+        {'DOWN', Ref, _, _, _} ->
 
 Review comment:
   You should pattern match the reason element as noproc so we're asserting 
that the process was dead before we tried to acquire the monitor. I'd also swap 
the return value to be {ok, Db} on success, or retry on failure. No need to 
return the input and pattern match it on use.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to