[squid-users] squid in container aborted on low memory server

George Xie georgexsh at gmail.com
Mon Mar 4 04:39:51 UTC 2019


hi all:

Squid version: 3.5.23-5+deb9u1
Docker version 18.09.3, build 774a1f4
Linux instance-4 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
GNU/Linux

I have the following squid config:


http_port 127.0.0.1:3128
cache deny all
access_log none


runs in a container with following Dockerfile:

FROM debian:9
RUN apt update && \
apt install --yes squid


the total memory of the host server is very low, only 592m, about 370m free
memory.
if I start squid in the container, squid will abort immediately.

error messages in /var/log/squid/cache.log:


FATAL: xcalloc: Unable to allocate 1048576 blocks of 392 bytes!

Squid Cache (Version 3.5.23): Terminated abnormally.
CPU Usage: 0.012 seconds = 0.004 user + 0.008 sys
Maximum Resident Size: 47168 KB


error message captured with strace -f -e trace=memory:

[pid   920] mmap(NULL, 411176960, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)


it appears that squid (or glibc) tries to allocate 392m memory, which is
larger than host free memory 370m.
but I guess squid don't need that much memory, I have another running squid
instance, which only uses < 200m memory.
the oddest thing is if I run squid on the host (also Debian 9) directly,
not in the container, squid could start and run as normal.

am I doing something wrong thing here?

Xie Shi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20190304/cef1c73c/attachment.html>


More information about the squid-users mailing list