Subject: Networking and memory (Was: Re: mb_map full and NMBCLUSTERS)
To: Jukka Marin <>
From: Michael Graff <>
List: current-users
Date: 09/07/1996 13:56:19
Jukka Marin <> writes:

> > I have a large number of connections which drop off the face of the planet
> > (www servers suck that way) and I noticed slowly increasing memory usage
> > in the networking code until I applied a variant of pr 2335...
> Please tell us more.

The only changes I made was to put it into a -current kernel.  I made
no functional changes, really.

Here is the text from the pr.  I noticed the problem in Description, so
I applied the patch and it went away until I went and increased the
number of connections my machine gets.  :)

Not all the 4.4BSD-Lite2 TCP patches, in particular the persist timeout 
patches seem to have made it into NetBSD-Current.  This means TCP sockets
can get into CLOSE_WAIT or FIN_WAIT_1 with data queued on them and neither
persist nor keepalive timers running, tieing up mbus forever and eventually
filling up the mbuf map

Run a machine with many TCP connections from dial-up clients which
may disappear from the net before closing down the TCP sockets (eg a web 
server or web cache).  Note that netstat -m shows network memory in use
monotonically increaing until mb_map fills up after some period.

This patch makes sure that TCP send window reaches zero that the persist
timer is running, and that if enough persist probes fail the socket will be
dropped (Stevens, "TCP/IP Illustrated, Volume 3", pp196--200).