From owner-freebsd-i386@FreeBSD.ORG Wed Feb 11 10:20:15 2004 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50AC316A4CE for ; Wed, 11 Feb 2004 10:20:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34BD543D31 for ; Wed, 11 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1BIKFbv013639 for ; Wed, 11 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1BIKFHW013638; Wed, 11 Feb 2004 10:20:15 -0800 (PST) (envelope-from gnats) Resent-Date: Wed, 11 Feb 2004 10:20:15 -0800 (PST) Resent-Message-Id: <200402111820.i1BIKFHW013638@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kevin Martin Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A4EF16A4CE for ; Wed, 11 Feb 2004 10:11:34 -0800 (PST) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4682243D31 for ; Wed, 11 Feb 2004 10:11:34 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i1BIBY72080043 for ; Wed, 11 Feb 2004 10:11:34 -0800 (PST) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.10/8.12.10/Submit) id i1BIBYMH080042; Wed, 11 Feb 2004 10:11:34 -0800 (PST) (envelope-from nobody) Message-Id: <200402111811.i1BIBYMH080042@www.freebsd.org> Date: Wed, 11 Feb 2004 10:11:34 -0800 (PST) From: Kevin Martin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.0 Subject: i386/62699: fstat randomly crashes with "out of memory" X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2004 18:20:15 -0000 >Number: 62699 >Category: i386 >Synopsis: fstat randomly crashes with "out of memory" >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 11 10:20:14 PST 2004 >Closed-Date: >Last-Modified: >Originator: Kevin Martin >Release: 4.8-STABLE >Organization: pair Networks, Inc >Environment: FreeBSD koloda.pair.com 4.8-STABLE FreeBSD 4.8-STABLE #0: Fri Oct 3 11:10:15 EDT 2003 sigma@koloda.pair.com:/usr/src/sys/compile/PAIRqm i386 >Description: About 1 in every 1000 runs, "fstat" will die with "Out of memory". The problem has been traced to line 349 of fstat.c 1.21.2.7, where filed.fd_lastfile occasionally gets a huge, incorrect value, and subsequently tries to malloc several gigabytes to hold the array of files. >How-To-Repeat: #!/bin/csh while (1) fstat >/dev/null end Watch for "Out of memory" instances. >Fix: A workaround is simply to insert a sanity check that fd_lastfile is less than, say, 100000. A more elegant workaround would be a comparison to the real size of the file table. A real fix would be to find out why garbage ends up in the filed structure, which is read via KVM_READ just a few lines earlier. >Release-Note: >Audit-Trail: >Unformatted: