Re: Squid dying ...

From: Michael Pelletier <mikep@dont-contact.us>
Date: Thu, 9 Jul 1998 09:46:34 -0400 (EDT)

On Thu, 9 Jul 1998, Michael Beckmann wrote:

> Paresh Kumar wrote:
>
> > I've got this situation where squid dies every coupla hours with this
> > message: "FATAL: xmalloc: unable to allocate 4096 bytes"
> >
> > We are using BSD/OS 3.0 with 128Mb RAM. I have been monitoring the amount
> > of free RAM and there's usually 30-40M free when it dies.
>
> I think what matters here is not the free RAM, but rather the memory
> available to the Squid process. Look at the size of the squid
> process, I suspect it dies when it reaches 64 MB.

This is correct. What matters here is the "datasize" parameter. If
you enter the command "ulimit -a" in Korn shell, you get something
like:

time(cpu-seconds) unlimited
file(blocks) unlimited
coredump(blocks) unlimited
data(kbytes) 16384
stack(kbytes) 131072
lockedmem(kbytes) unlimited
memory(kbytes) unlimited
nofiles(descriptors) 13196
processes 4116

In
BSD/OS you set the MAXDSIZ parameter in the kernel configuration:

inet-prime$ cd /usr/src/sys/386/conf
inet-prime$ vi INET-PRIME

Around line 63 of the configuration file, you see a line that says:

# support for large routing tables, e.g. gated with full Internet routing:
options "KMEMSIZE=\(16*1024*1024\)"
options "DFLSSIZ=\(8*1024*1024\)"

Right there's a good place to add the following lines:

options "DFLDSIZ=\(128*1024*1024\)"
options "MAXDSIZ=\(256*1024*1024\)"
options "CHILD_MAX=256"

(CHILD_MAX is for Apache, if you're running that too...) You can set
the DFLDSIZ (the default datasize) and the MAXDSIZ to whatever suits
your machine's memory configuration. However, I have had problems
getting Squid to function correctly on my Intel Pentium-133 with a
datasize of greater than 128MB, even though I have 256MB available on
the system. Let me know if it works for you. Squid will generally
stay up and running for at least a week, and usually more like 3-4
weeks, with 128MB limit and a 24MB hot cache size on a 3,750MB cache,
so I don't worry about it too much -- RunCache restarts it
automatically anyway.

In order to allow Squid to max out this limit as set in the kernel,
you should add the following to the RunCache script:

unlimit; unlimit datasize

Right up at the beginning of the script. I found while running
news.daily that for some reason, when you do "unlimit" and then switch
users, the datasize clicks back to its original miniscule value.
Hence the addition of "unlimit datasize" after the "unlimit," just to
be on the safe side.

        -Mike Pelletier.
Received on Thu Jul 09 1998 - 06:48:29 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:41:04 MST