diff options
author | Adam Kocoloski <adam@cloudant.com> | 2011-06-29 11:24:33 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2011-06-29 11:25:59 -0400 |
commit | 48a011a89cd17b00801ade91aa755f7adde44e11 (patch) | |
tree | 4e96bff23fa0eb7db16677b664641ca7a0ba0c27 | |
parent | 266ba88ac6ded40087e0211ad9e75e4ce64e66cb (diff) |
Guard against dead fd process in is_idle/1
BugzID: 12365
-rw-r--r-- | apps/couch/src/couch_db.erl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/couch/src/couch_db.erl b/apps/couch/src/couch_db.erl index b9b66f4b..dec6870f 100644 --- a/apps/couch/src/couch_db.erl +++ b/apps/couch/src/couch_db.erl @@ -112,8 +112,12 @@ open_ref_counted(MainPid, OpenedPid) -> gen_server:call(MainPid, {open_ref_count, OpenedPid}). is_idle(#db{compactor_pid=nil, waiting_delayed_commit=nil} = Db) -> - {monitored_by, Pids} = erlang:process_info(Db#db.fd, monitored_by), - (Pids -- [Db#db.main_pid, whereis(couch_stats_collector)]) =:= []; + case erlang:process_info(Db#db.fd, monitored_by) of + undefined -> + true; + {monitored_by, Pids} -> + (Pids -- [Db#db.main_pid, whereis(couch_stats_collector)]) =:= [] + end; is_idle(_Db) -> false. |