From baa779ddaaffdf410f73167991ec3ead4b6859fd Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Sat, 21 Jan 2012 21:17:33 +0100 Subject: [PATCH] Fix a bug in lsm_tree:close/1. There is a race condition based on the monitor set in a call. We might get a normal exit from the monitor message deep inside gen_server. This has to be handled. I've seen this race in my QC tests. --- src/lsm_btree.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lsm_btree.erl b/src/lsm_btree.erl index 80929cc..4890984 100644 --- a/src/lsm_btree.erl +++ b/src/lsm_btree.erl @@ -23,7 +23,9 @@ close(Ref) -> gen_server:call(Ref, close) catch exit:{noproc,_} -> ok; - exit:noproc -> ok + exit:noproc -> ok; + %% Handle the case where the monitor triggers + exit:{normal, _} -> ok end.