summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobert Dionne <bob@cloudant.com>2011-02-18 16:00:16 -0500
committerAdam Kocoloski <adam@cloudant.com>2011-04-18 12:54:49 -0400
commit7d1adfaf7d67c7e0af837b8067850b7ea0b7f95a (patch)
tree741de3616cd9b819cce16a3ced313f426a835aef /apps
parent4835509f8d023006b9f405c4b04847a5c1e38473 (diff)
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
Diffstat (limited to 'apps')
-rw-r--r--apps/couch/src/couch_server.erl4
1 files changed, 2 insertions, 2 deletions
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.