Always report why couch_server crashes On servers with a large number of open databases the couch_server state is too large to be logged, and so when it crashes we miss the reason for the crash. This patch adds an extra message that redacts enough of the server state to ensure a properly-formatted message.
BugzID: 26902 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/6083a37b Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/6083a37b Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/6083a37b Branch: refs/heads/windsor-merge Commit: 6083a37b87093d314adb491bab6d2e81e7c71610 Parents: f3e4538 Author: Adam Kocoloski <[email protected]> Authored: Fri Feb 28 12:45:02 2014 -0500 Committer: Robert Newson <[email protected]> Committed: Tue Aug 26 10:42:38 2014 +0100 ---------------------------------------------------------------------- src/couch_server.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/6083a37b/src/couch_server.erl ---------------------------------------------------------------------- diff --git a/src/couch_server.erl b/src/couch_server.erl index 28dfc79..964ecad 100644 --- a/src/couch_server.erl +++ b/src/couch_server.erl @@ -210,7 +210,9 @@ init([]) -> update_lru_on_read=UpdateLruOnRead, start_time=couch_util:rfc1123_date()}}. -terminate(_Reason, _Srv) -> +terminate(Reason, Srv) -> + ?LOG_ERROR("couch_server terminating with ~p, state ~2048p", [Reason, + Srv#server{dbname_regexp = redacted, lru = redacted}]), ets:foldl(fun(#db{main_pid=Pid}, _) -> couch_util:shutdown_sync(Pid) end, nil, couch_dbs), ok.
