Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4A0EE1E8 for ; Sat, 26 Jan 2013 22:11:48 +0000 (UTC) Received: (qmail 64076 invoked by uid 500); 26 Jan 2013 22:11:48 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 64055 invoked by uid 500); 26 Jan 2013 22:11:48 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 64042 invoked by uid 99); 26 Jan 2013 22:11:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jan 2013 22:11:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jan 2013 22:11:38 +0000 Received: from [10.0.0.13] (91-66-82-235-dynip.superkabel.de [91.66.82.235]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.traeumt.net (Postfix) with ESMTPSA id 356BD1409A; Sat, 26 Jan 2013 23:06:49 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: git commit: (COUCHDB-1305) isolate db process crashes From: Jan Lehnardt In-Reply-To: <20130126205254.CC03C825F1D@tyr.zones.apache.org> Date: Sat, 26 Jan 2013 23:11:16 +0100 Cc: commits@couchdb.apache.org Content-Transfer-Encoding: quoted-printable Message-Id: <6E5CEB34-64C2-4ABE-ACA0-D6D3DD447AF4@apache.org> References: <20130126205254.CC03C825F1D@tyr.zones.apache.org> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1499) X-Virus-Checked: Checked by ClamAV on apache.org On Jan 26, 2013, at 21:52 , randall@apache.org wrote: > Updated Branches: > refs/heads/master acd5f6876 -> 09d6787ef >=20 >=20 > (COUCHDB-1305) isolate db process crashes >=20 > Merge of 1305-fix-isolate-db-crashes >=20 > [@davisp: I'll keep doing this nonsense until we allow merge commits!] <3 >=20 > Note that there was previously a small error where couch_sys_dbs ETS > table was being searched for a #db record rather than the db name. >=20 > That's fixed here because I saw it. Sorry for not making it a > separate commit. >=20 > Squashed commit of the following: >=20 > commit f9e4e8a6e426d1569fac4cd707bbd393b102147d > Author: Randall Leeds > Date: Sat Jan 26 06:28:20 2013 -0800 >=20 > don't handle case clause when death happens anyway >=20 > Presumably the reason for the process exit is already logged by > the exiting process (unlike an unexpected message of another sort > which may not have been logged already). >=20 > commit 10a052a3eddbd7e89b553966895ee38a9ce439d4 > Author: Randall Leeds > Date: Sat Jan 26 06:25:23 2013 -0800 >=20 > consolidate two similar handle_info clauses >=20 > commit 6f3feb09e347dfe0c6812fd71e3f40d15d8d1ced > Author: Randall Leeds > Date: Sat Jan 26 04:35:35 2013 -0800 >=20 > isolate db process crashes in couch_server >=20 > closes COUCHDB-1305 >=20 >=20 > Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo > Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/09d6787e > Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/09d6787e > Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/09d6787e >=20 > Branch: refs/heads/master > Commit: 09d6787efdd40f7dd10dbb34cf80a9d88e1af502 > Parents: acd5f68 > Author: Randall Leeds > Authored: Sat Jan 26 12:39:58 2013 -0800 > Committer: Randall Leeds > Committed: Sat Jan 26 12:51:07 2013 -0800 >=20 > ---------------------------------------------------------------------- > src/couchdb/couch_server.erl | 51 = ++++++++++++++++++++++++++----------- > 1 files changed, 36 insertions(+), 15 deletions(-) > ---------------------------------------------------------------------- >=20 >=20 > = http://git-wip-us.apache.org/repos/asf/couchdb/blob/09d6787e/src/couchdb/c= ouch_server.erl > ---------------------------------------------------------------------- > diff --git a/src/couchdb/couch_server.erl = b/src/couchdb/couch_server.erl > index 6e25235..8189761 100644 > --- a/src/couchdb/couch_server.erl > +++ b/src/couchdb/couch_server.erl > @@ -426,27 +426,48 @@ code_change(_OldVsn, State, _Extra) -> >=20 > handle_info({'EXIT', _Pid, config_change}, Server) -> > {noreply, shutdown, Server}; > -handle_info({'EXIT', Pid, snappy_nif_not_loaded}, Server) -> > +handle_info({'EXIT', Pid, Reason}, Server) -> > Server2 =3D case ets:lookup(couch_dbs_by_pid, Pid) of > [{Pid, Db}] -> > - [{Db, {opening, Pid, Froms}}] =3D = ets:lookup(couch_dbs_by_name, Db), > - Msg =3D io_lib:format("To open the database `~s`, Apache = CouchDB " > - "must be built with Erlang OTP R13B04 or higher.", [Db]), > - ?LOG_ERROR(Msg, []), > - lists:foreach( > - fun(F) -> gen_server:reply(F, {bad_otp_release, Msg}) = end, > - Froms), > - true =3D ets:delete(couch_dbs_by_name, Db), > - true =3D ets:delete(couch_dbs_by_pid, Pid), > - case ets:lookup(couch_sys_dbs, Db) of > + DbName =3D Db#db.name, > + > + % If the Pid is known, the name should be as well. > + % If not, that's an error, which is why there is no [] = clause. > + case ets:lookup(couch_dbs_by_name, DbName) of > + [{_, {opening, Pid, Froms}}] -> > + Msg =3D case Reason of > + snappy_nif_not_loaded -> > + io_lib:format( > + "To open the database `~s`, Apache CouchDB " > + "must be built with Erlang OTP R13B04 or = higher.", > + [Db] > + ); > + true -> > + io_lib:format("Error opening database ~p: ~p", = [DbName, Reason]) > + end, > + ?LOG_ERROR(Msg, []), > + lists:foreach( > + fun(F) -> gen_server:reply(F, {bad_otp_release, Msg}) = end, > + Froms > + ); > + [{_, {opened, Pid, LruTime}}] -> > + ?LOG_ERROR( > + "Unexpected exit of database process ~p [~p]: ~p", > + [Pid, DbName, Reason] > + ), > + true =3D ets:delete(couch_dbs_by_lru, LruTime) > + end, > + > + true =3D ets:delete(couch_dbs_by_pid, DbName), > + true =3D ets:delete(couch_dbs_by_name, DbName), > + > + case ets:lookup(couch_sys_dbs, DbName) of > [{Db, _}] -> > - true =3D ets:delete(couch_sys_dbs, Db), > + true =3D ets:delete(couch_sys_dbs, DbName), > Server; > [] -> > Server#server{dbs_open =3D Server#server.dbs_open - 1} > - end; > - _ -> > - Server > + end > end, > {noreply, Server2}; > handle_info(Error, _Server) -> >=20