From 48a011a89cd17b00801ade91aa755f7adde44e11 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 29 Jun 2011 11:24:33 -0400 Subject: Guard against dead fd process in is_idle/1 BugzID: 12365 --- apps/couch/src/couch_db.erl | 8 ++++++-- 1 file 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. -- cgit v1.2.3