From owner-freebsd-current@FreeBSD.ORG Sun Aug 19 23:32:46 2007 Return-Path: Delivered-To: current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4B5F16A418; Sun, 19 Aug 2007 23:32:46 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out-04.forthnet.gr (mx-out.forthnet.gr [193.92.150.103]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7B713C46A; Sun, 19 Aug 2007 23:32:45 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-01.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-04.forthnet.gr (8.13.8/8.13.8) with ESMTP id l7JMOAFd029289; Mon, 20 Aug 2007 01:24:10 +0300 Received: from MX-IN-03.forthnet.gr (mx-in-03.forthnet.gr [193.92.150.26]) by mx-av-01.forthnet.gr (8.14.1/8.14.1) with ESMTP id l7JMOAoV017137; Mon, 20 Aug 2007 01:24:10 +0300 Received: from [213.16.200.70] (ppp1-70.kef.forthnet.gr [213.16.200.70]) by MX-IN-03.forthnet.gr (8.14.1/8.14.1) with ESMTP id l7JMNqkO010474; Mon, 20 Aug 2007 01:24:04 +0300 Authentication-Results: MX-IN-03.forthnet.gr smtp.mail=dds@aueb.gr; spf=neutral Authentication-Results: MX-IN-03.forthnet.gr header.from=dds@aueb.gr; sender-id=neutral Message-ID: <46C8C2E6.9030405@aueb.gr> Date: Mon, 20 Aug 2007 01:23:34 +0300 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070509 SeaMonkey/1.1.2 MIME-Version: 1.0 To: Robert Watson References: <20070819214953.I1099@fledge.watson.org> In-Reply-To: <20070819214953.I1099@fledge.watson.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sun, 19 Aug 2007 23:38:20 +0000 Cc: attilio@FreeBSD.ORG, jeff@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: Crash in accounting code: encode_long(), due to bad rusage data? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2007 23:32:46 -0000 Robert Watson wrote: > I recently upgraded two servers from FreeBSD 6-STABLE to FreeBSD > 7-CURRENT in anticipation of the forthcoming release. Both of them run > with accounting enabled at all times. When a large pine session was > exiting on one of the two boxes, I ran into the following panic: > > panic: encode_long: -ve value -32749 Getting rid of the panic is easy: --- kern_acct.c 2007-08-20 01:15:18.000000000 +0300 +++ kern_acct.c.new 2007-08-20 01:16:06.000000000 +0300 @@ -523,8 +523,7 @@ int norm_exp; /* Normalized exponent */ int shift; - KASSERT(val >= 0, ("encode_long: -ve value %ld", val)); - if (val == 0) + if (val <= 0) return (0); norm_exp = fls(val) - 1; shift = FLT_MANT_DIG - norm_exp - 1; However, as you wrote, this doesn't fix the root of the problem. > I find the large negative value in ru_idrss somewhat sad to contemplate, > and while this could well be a problem with capturing of process runtime > information, I'd like it if the accounting code were robust against this > sort of bug, rather than panicking, and I guess I'd also rather than the > process runtime information also be correctly captured :-). Do you think it makes any sense for encode_long to be correctly encoding negative numbers, or should we concentrate on locating and fixing the negative ru_idrss problem? Diomidis Spinellis - http://www.spinellis.gr