From 7d1adfaf7d67c7e0af837b8067850b7ea0b7f95a Mon Sep 17 00:00:00 2001 From: Robert Dionne Date: Fri, 18 Feb 2011 16:00:16 -0500 Subject: Monitor Fd after creating DB This patch has the side effect of fixing a crash of the _users DB after the first minute of running. The crash occurs because BigCouch presumes that couch_stats_collector is monitoring the file descriptor, but nothing prevents the supervisor from starting couch_auth_cache (and thus opening the _users DB) before couch_stats_collector is started. The start order is determined by the ordering of the children from the config file in couch_config's ets set. Closes #39 BugzID: 11854 --- apps/couch/src/couch_server.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/couch/src/couch_server.erl') diff --git a/apps/couch/src/couch_server.erl b/apps/couch/src/couch_server.erl index bfbe9c09..4252a035 100644 --- a/apps/couch/src/couch_server.erl +++ b/apps/couch/src/couch_server.erl @@ -65,9 +65,9 @@ close_lru() -> create(DbName, Options) -> case gen_server:call(couch_server, {create, DbName, Options}, infinity) of - {ok, Db} -> + {ok, #db{fd=Fd} = Db} -> Ctx = couch_util:get_value(user_ctx, Options, #user_ctx{}), - {ok, Db#db{user_ctx=Ctx}}; + {ok, Db#db{user_ctx=Ctx, fd_monitor=erlang:monitor(process,Fd)}}; Error -> Error end. -- cgit v1.2.3