From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 23 00:36:11 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 026CA16A422 for ; Thu, 23 Feb 2006 00:36:10 +0000 (GMT) (envelope-from viktor.vasilev@stud.tu-darmstadt.de) Received: from lnx130.hrz.tu-darmstadt.de (lnx130.hrz.tu-darmstadt.de [130.83.174.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9D8843D45 for ; Thu, 23 Feb 2006 00:36:09 +0000 (GMT) (envelope-from viktor.vasilev@stud.tu-darmstadt.de) Received: from mailserver3.hrz.tu-darmstadt.de (lnx115.hrz.tu-darmstadt.de [130.83.174.27]) by lnx130.hrz.tu-darmstadt.de (8.12.10/8.12.10) with ESMTP id k1N0a84x028811 for ; Thu, 23 Feb 2006 01:36:08 +0100 Received: from [130.83.20.203] (helo=ABC216.ram1st.wh.tu-darmstadt.de) by mailserver3.hrz.tu-darmstadt.de with esmtpsa (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.50) id 1FC4Sl-00038K-Qs for hackers@freebsd.org; Thu, 23 Feb 2006 01:36:07 +0100 From: Viktor Vasilev To: hackers@freebsd.org Date: Thu, 23 Feb 2006 01:36:06 +0100 User-Agent: KMail/1.8.3 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_2NQ/DNCe++IlWBH" Message-Id: <200602230136.06689.viktor.vasilev@stud.tu-darmstadt.de> Cc: Subject: Looking for advice on chasing a kernel memory leak X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2006 00:36:11 -0000 --Boundary-00=_2NQ/DNCe++IlWBH Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I'm having trouble with a WARP (http://www.pcengines.ch/wrap.htm) board running m0n0wall v1.21 (stripped down FreeBSD 4.11-RELEASE-p13). It's serving as an internet gateway and the problem is, that after some time it starts blocking traffic and doesn't do NAT anymore. The box is handling very low traffic volume and is mostly idle. I've enabled logging to a remote machine and around the time the trouble happens, there are messages like these: Jan 15 04:02:25 gw /kernel: ipf_nattable_max reduced to -96 Jan 15 04:02:49 gw /kernel: ipf_nattable_max reduced to -94 Jan 15 04:02:49 gw /kernel: ipf_nattable_max reduced to -94 Jan 15 04:04:31 gw /kernel: ipf_nattable_max reduced to -92 An inspection of the ipfilter code shows that kmem_alloc is failing: http://fxr.watson.org/fxr/source/contrib/ipfilter/netinet/ip_nat.c?v=RELENG4#L1197 A reboot fixes the things until the same thing happens again in three or so weeks. Since that happened a couple of times, I've monitored RAM usage and see a constant growth of the wired memory. After reboot top reports: Mem: 4312K Active, 3684K Inact, 5960K Wired, 4848K Buf, 99M Free Now after two weeks: Mem: 5044K Active, 3824K Inact, 22M Wired, 5856K Buf, 82M Free vmstat -m output (attached) clearly shows that there's a huge amount of M_TEMP memory held and growing: temp 30370 15148K 15169K 19166K 16804822 0 0 16,32,64,128,256,512,1K,4K,8K,32K,256K,512K I don't know how to find out who actually allocates this memory. Any ideas? ps auxwww output, kernel config and dmesg are attached. Cheers, Viktor --Boundary-00=_2NQ/DNCe++IlWBH Content-Type: text/plain; charset="us-ascii"; name="wrap-dmesg.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="wrap-dmesg.txt" Copyright (c) 1992-2005 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.11-RELEASE-p13 #0: Sat Nov 26 12:17:56 CET 2005 root@fb411.neon1.net:/usr/src/sys/compile/M0N0WALL_WRAP Timecounter "i8254" frequency 1193182 Hz CPU: NSC Geode (266.64-MHz 586-class CPU) Origin = "Geode by NSC" Id = 0x540 Stepping = 0 DIR=0x81b7 Features=0x808131 real memory = 134217728 (131072K bytes) avail memory = 116117504 (113396K bytes) Preloaded elf kernel "kernel" at 0xc0e03000. Preloaded mfs_root "/mfsroot" at 0xc0e030a8. md0: Preloaded image 11534336 bytes at 0xc0301df0 md1: Malloc disk npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 sis0: port 0x1000-0x10ff mem 0x80000000-0x80000fff irq 10 at device 14.0 on pci0 sis0: Ethernet address: 00:0d:b9:02:c4:d0 miibus0: on sis0 ukphy0: on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto sis1: port 0x1400-0x14ff mem 0x80040000-0x80040fff irq 9 at device 15.0 on pci0 sis1: Ethernet address: 00:0d:b9:02:c4:d1 miibus1: on sis1 ukphy1: on miibus1 ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto sis2: port 0x1800-0x18ff mem 0x80080000-0x80080fff irq 11 at device 16.0 on pci0 sis2: Ethernet address: 00:0d:b9:02:c4:d2 miibus2: on sis2 ukphy2: on miibus2 ukphy2: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto isab0: port 0xf600-0xf63f,0xf400-0xf43f at device 18.0 on pci0 isa0: on isab0 chip1: port 0xf000-0xf0ff at device 18.1 on pci0 atapci0: port 0xfc00-0xfc0f at device 18.2 on pci0 ata0: at 0x1f0 irq 14 on atapci0 pci0: (vendor=0x100b, dev=0x0503) at 18.3 chip2: port 0xf200-0xf23f at device 18.5 on pci0 orm0: