Subject: kern/17626: mbuf leak on a router box
To: None <gnats-bugs@gnats.netbsd.org>
From: Anthony Mallet <anthony.mallet@useless-ficus.net>
List: netbsd-bugs
Date: 07/17/2002 22:04:56
>Number:         17626
>Category:       kern
>Synopsis:       mbuf leak on a router box
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 17 13:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Anthony Mallet
>Release:        NetBSD 1.5ZC (may 7 2002)
>Organization:
>Environment:
System: NetBSD cactus 1.5ZC NetBSD 1.5ZC (CACTUS) i386
Architecture: i386
Machine: i386
>Description:
there seems to be a leak in mbufs routines.

(same symptom as for PR#14209 except that it /doesn't/ (??) seems to be
an NFS-related problem)

I have three boxes running 1.6D and 1.5ZC. One of them ('cactus') act as
a router for my internal network. All of them do NFS mounting, but I see
mbufs leaks only on the router box, as shown by the following netstats :
(I've been observing those symptoms for a long time now, and since many
different kernels (maybe since the early 1.5's, I can't remember
exactly))

ficus[~] > netstat -m // OK
94 mbufs in use:
        6 mbufs allocated to data
        87 mbufs allocated to packet headers
        1 mbufs allocated to socket names and addresses
65/74 mapped pages in use
216 Kbytes allocated to network (84% in use)
0 requests for memory denied
0 requests for memory delayed
88 calls to protocol drain routines

crocus[~] > netstat -m // OK
62 mbufs in use:
        1 mbufs allocated to data
        58 mbufs allocated to packet headers
        3 mbufs allocated to socket names and addresses
247/256 mapped pages in use
604 Kbytes allocated to network (95% in use)
0 requests for memory denied
0 requests for memory delayed
380 calls to protocol drain routines

cactus# netstat -m // Doesn't stop growing...
17963 mbufs in use:
        17955 mbufs allocated to data
        2 mbufs allocated to packet headers
        6 mbufs allocated to socket names and addresses
60/68 mapped pages in use
4640 Kbytes allocated to network (99% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines

(the router is cactus above, and now has an impressive mbuf count...)

The mbuf counter sometimes decreases a bit on cactus (a few mbufs a
apparently freed), but the allocated number usually only grows.
Of course, after a variable amout of time (2-3 weeks for normal use, as
few as 8h under heavy load), the box runs out of mbufs and start entering
into a well known 'guru meditation', looking desperately for mbufs :)

The other boxes are very ok...

I'm using the following network interfaces (I know both are bad :):

On the router rtk and ne (the latter for a 512kbps DSL connection):
rtk0 at pci0 dev 19 function 0: RealTek 8139 10/100BaseTX
OUI 0x000000 model 0x0000 rev 0 at rtk0 phy 7 not configured
ne0 at pci0 dev 20 function 0: RealTek 8029 Ethernet
ne0: 10base2, 10baseT, 10baseT-FDX, auto, default [0x03 0x70] auto

On the other boxes rtk:
rtk0 at pci0 dev 9 function 0: RealTek 8139 10/100BaseTX
OUI 0x000000 model 0x0000 rev 0 at rtk0 phy 7 not configured

I also use ipnat/ipfilter and other usual router-related stuff on the
router.

>How-To-Repeat:
Run a very tcp demanding application through (*not* *on*) a NAT-ed router
box (such as a P2P application :) and look at the output of netsat -m.
The allocated number doesn't decrease even after having quitted the
very demanding application.

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: