I have several systems running as firewalls on Alix boards running OpenBSD
4.6 as packaged by Flashdist. Flashdist by default mounts a compact flash
card read-only, and does not configure any swap space. Most of these
systems also run OpenVPN.
I'm experiencing a memory leak on many of these systems that runs the
machine out of memory in 2-4 weeks. I suspect it has something to do with
OpenVPN but am trying to pin it down. I can see the fre count diminish from
vmstat, but can't account for where the memory is going. It is not showing
up as a rising avm count in vmstat, is not showing up as rising size counts
in top or ps -- it seems to be just vanishing into thin air.
The machines that aren't running OpenVPN seem to be OK. If I take a machine
running OpenVPN and kill openvpn, I don't get the memory back. Is it
possible that somehow the tun driver is taking the memory? The picture I
have in my head is that the fre count in vmstat is showing *user-space*
memory, and a driver should only be taking kernel memory. But maybe that is
wrong.
I'm certainly not finding the missing memory with netstat -m, or vmstat -m
which says:
Kmem statistics are not being gathered by the kernel
It looks like I have to turn on option KMEMSTATS and make a new kernel to
get vmstat -m to show me what's happening in the kernel. Would this be the
recommended move to try to diagnose this problem?
Are there any known memory leaks in the tun driver?
Any insights on how to sniff this out would be much appreciated. dmesg
follows.
-Thanks, Jim
---
OpenBSD 4.6-stable (alix) #0: Fri Nov 13 15:24:14 EST 2009
r...@hermes2.rossint.net:/local/usr/root/kernel/alix
cpu0: Geode(TM) Integrated Processor by AMD PCS ("AuthenticAMD" 586-class)
499 MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX
real mem = 268009472 (255MB)
avail mem = 255754240 (243MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/05/08, BIOS32 rev. 0 @ 0xfd088
pcibios0 at bios0: rev 2.1 @ 0xf0000/0x10000
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe0000/0xa800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 1 function 0 "AMD Geode LX" rev 0x33
glxsb0 at pci0 dev 1 function 2 "AMD Geode LX Crypto" rev 0x00: RNG AES
vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10,
address 00:0d:b9:1b:a4:04
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
vr1 at pci0 dev 10 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 11,
address 00:0d:b9:1b:a4:05
ukphy1 at vr1 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
vr2 at pci0 dev 11 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 15,
address 00:0d:b9:1b:a4:06
ukphy2 at vr2 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
0x004063, model 0x0034
glxpcib0 at pci0 dev 15 function 0 "AMD CS5536 ISA" rev 0x03: rev 0, 32-bit
3579545Hz timer, watchdog, gpio
gpio0 at glxpcib0: 32 pins
pciide0 at pci0 dev 15 function 2 "AMD CS5536 IDE" rev 0x01: DMA, channel 0
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <SanDisk SDCFH-002G>
wd0: 1-sector PIO, LBA, 1918MB, 3928176 sectors
wd0(pciide0:0:0): using PIO mode 4, DMA mode 2
pciide0: channel 1 ignored (disabled)
ohci0 at pci0 dev 15 function 4 "AMD CS5536 USB" rev 0x02: irq 12, version
1.0, legacy support
ehci0 at pci0 dev 15 function 5 "AMD CS5536 USB" rev 0x02: irq 12
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
isa0 at glxpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "AMD OHCI root hub" rev 1.00/1.00 addr 1
biomask 73e7 netmask ffe7 ttymask ffff
mtrr: K6-family MTRR support (2 registers)
root on wd0a swap on wd0b dump on wd0b
clock: unknown CMOS layout