RE: [squid-users] Squid reconfigure causes swap=0

From: Nil Nik <nil_fergi_at_hotmail.com>
Date: Sat, 21 Jan 2012 14:35:12 +0000

Tested squid-3.1.18 on:
Fedora 13 (2.6.33.3-85.fc13.i686.PAE)
Ubuntu 8.4 (2.6.24.6)

If we compile the squid with --enable-ssl option then squid process increases its memory usages fast as compare with without --enable-ssl option.
Test with 2GB memory.
with --enable-ssl option: around 6 times reload increases 0.1% memory.
without --enable-ssl option: around 25 times reload increases 0.1% memory.

Valgrind Shows:
# valgrind --tool=memcheck --leak-check=full /usr/local/squid/sbin/squid -N d 10
==17606== Memcheck, a memory error detector
==17606== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==17606== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==17606== Command: /usr/local/squid/sbin/squid -N d 10
==17606==
==17606== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17606==    at 0xC7753E: epoll_ctl (syscall-template.S:82)
==17606==    by 0x80DB513: idnsInit (dns_internal.cc:1426)
==17606==    by 0x812B479: mainInitialize() (main.cc:979)
==17606==    by 0x812C33A: SquidMain(int, char**) (main.cc:1385)
==17606==    by 0x812C9D2: main (main.cc:1176)
==17606==  Address 0xbea2136c is on thread 1's stack
==17606==
==17606== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17606==    at 0xC7753E: epoll_ctl (syscall-template.S:82)
==17606==    by 0x80DB39F: idnsInit (dns_internal.cc:1431)
==17606==    by 0x812B479: mainInitialize() (main.cc:979)
==17606==    by 0x812C33A: SquidMain(int, char**) (main.cc:1385)
==17606==    by 0x812C9D2: main (main.cc:1176)
==17606==  Address 0xbea2136c is on thread 1's stack
==17606==
==17606== Warning: invalid file descriptor 1014 in syscall close()
==17606== Warning: invalid file descriptor 1015 in syscall close()
==17606== Warning: invalid file descriptor 1016 in syscall close()
==17606==    Use --log-fd=<number> to select an alternative log fd.
==17606== Warning: invalid file descriptor 1017 in syscall close()
==17606== Warning: invalid file descriptor 1018 in syscall close()
==17606== Warning: invalid file descriptor 1019 in syscall close()
==17606== Warning: invalid file descriptor 1020 in syscall close()
==17606== Warning: invalid file descriptor 1021 in syscall close()
==17606== Warning: invalid file descriptor 1022 in syscall close()
==17606== Warning: invalid file descriptor 1023 in syscall close()
==17606== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17606==    at 0xC7753E: epoll_ctl (syscall-template.S:82)
==17606==    by 0x8177878: AcceptFD::subscribe(RefCount<AsyncCall>&) (comm.cc:2277)
==17606==    by 0x81789C5: comm_accept(int, void (*)(int, int, ConnectionDetail*, comm_err_t, int, void*), void*)
(comm.cc:2249)
==17606==    by 0x80BAAA2: clientOpenListenSockets (client_side.cc:3575)
==17606==    by 0x812A9BA: serverConnectionsOpen() (main.cc:619)
==17606==    by 0x812B4D6: mainInitialize() (main.cc:1063)
==17606==    by 0x812C33A: SquidMain(int, char**) (main.cc:1385)
==17606==    by 0x812C9D2: main (main.cc:1176)
==17606==  Address 0xbea211cc is on thread 1's stack
==17606==
==17606== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17606==    at 0xC7753E: epoll_ctl (syscall-template.S:82)
==17606==    by 0x80DB513: idnsInit (dns_internal.cc:1426)
==17606==    by 0x812BA44: mainReconfigureFinish(void*) (main.cc:782)
==17606==    by 0x8171449: AsyncCall::make() (AsyncCall.cc:34)
==17606==    by 0x8173DA3: AsyncCallQueue::fireNext() (AsyncCallQueue.cc:53)
==17606==    by 0x8173F27: AsyncCallQueue::fire() (AsyncCallQueue.cc:39)
==17606==    by 0x80E27D9: EventLoop::runOnce() (EventLoop.cc:118)
==17606==    by 0x80E290F: EventLoop::run() (EventLoop.cc:94)
==17606==    by 0x812C3C2: SquidMain(int, char**) (main.cc:1418)
==17606==    by 0x812C9D2: main (main.cc:1176)
==17606==  Address 0xbea2123c is on thread 1's stack
==17606==
==17606== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==17606==    at 0xC7753E: epoll_ctl (syscall-template.S:82)
==17606==    by 0x80DB39F: idnsInit (dns_internal.cc:1431)
==17606==    by 0x812BA44: mainReconfigureFinish(void*) (main.cc:782)
==17606==    by 0x8171449: AsyncCall::make() (AsyncCall.cc:34)
==17606==    by 0x8173DA3: AsyncCallQueue::fireNext() (AsyncCallQueue.cc:53)
==17606==    by 0x8173F27: AsyncCallQueue::fire() (AsyncCallQueue.cc:39)
==17606==    by 0x80E27D9: EventLoop::runOnce() (EventLoop.cc:118)
==17606==    by 0x80E290F: EventLoop::run() (EventLoop.cc:94)
==17606==    by 0x812C3C2: SquidMain(int, char**) (main.cc:1418)
==17606==    by 0x812C9D2: main (main.cc:1176)
==17606==  Address 0xbea2123c is on thread 1's stack
==17606==
==17606==
==17606== HEAP SUMMARY:
==17606==     in use at exit: 0 bytes in 0 blocks
==17606==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==17606==
==17606== All heap blocks were freed -- no leaks are possible
==17606==
==17606== For counts of detected and suppressed errors, rerun with: -v
==17606== Use --track-origins=yes to see where uninitialised values come from
==17606== ERROR SUMMARY: 471 errors from 5 contexts (suppressed: 25 from 10)
Aborted (core dumped)

Please help to locate issue.

----------------------------------------
> From: nil_fergi_at_hotmail.com
> To: squid-users_at_squid-cache.org
> CC: squid3_at_treenet.co.nz
> Date: Fri, 20 Jan 2012 15:29:58 +0000
> Subject: Re: [squid-users] Squid reconfigure causes swap=0
>
>
>
>
> # ./squid -v
> Squid Cache: Version 3.1.16
> configure options:
> '--enable-ssl' --with-squid=/squid-3.1.16 --enable-ltdl-convenience
>
> Version 3.1.16 also show this problem. Let me test squid-3.1.18.
>
> ----------------------------------------
> > From: nil_fergi_at_hotmail.com
> > To: squid-users_at_squid-cache.org
> > Date: Fri, 20 Jan 2012 10:10:01 +0000
> > Subject: [squid-users] Squid reconfigure causes swap=0
> >
> >
> > Hello,
> >
> > Squid reload can cause to swap=0.
> > This problem can be generate by reloading (squid -k reconfigure) squid.
> > After every reload it increases the memory used by squid process, if we continue its causes the swap to 0 and squid crashes.
> >
> > I am Using default squid configuration.
> >
> > ./squid -v
> > Squid Cache: Version 3.1.9-20101129
> > configure
> > options: '--build=i386-redhat-linux-gnu'
> > '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu'
> > '--enable-icap-client' '--enable-epoll' '--enable-snmp' '--enable-ssl'
> > '--with-openssl=/usr/kerberos' '--enable-delay-pools'
> > '--enable-linux-netfilter' '--with-pthreads'
> > '--enable-digest-auth-helpers=password' '--with-winbind-auth-challenge'
> > '--enable-useragent-log' '--enable-referer-log'
> > '--disable-dependency-tracking' '--enable-cachemgr-hostname=localhost'
> > '--enable-underscores' '--enable-cache-digests' '--enable-ident-lookups'
> > '--with-large-files' '--enable-follow-x-forwarded-for'
> > '--enable-wccpv2' '--enable-fd-config' '--with-maxfd=16384'
> > 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu'
> > 'target_alias=i386-redhat-linux-gnu' --with-squid=/squid-3.1.9-20101129
> > --enable-ltdl-convenience
> >
> > uname -r
> > 2.6.33.3-85.fc13.i686.PAE
> >
> > Squid Version 3.1.10 also shows same behavior.
> >
> > valgrind (run for 3.1.10) shows as below:
> > ..
> > ..
> > 2012/01/20 09:51:06| Reconfiguring Squid Cache (version 3.1.10)...
> > 2012/01/20 09:51:06| FD 12 Closing HTTP connection
> > 2012/01/20 09:51:07| Processing Configuration File: /etc/squid/squid.conf (depth 0)
> > 2012/01/20 09:51:07| Initializing https proxy context
> > 2012/01/20 09:51:11| Squid plugin modules loaded: 0
> > 2012/01/20 09:51:11| Adaptation support is off.
> > 2012/01/20 09:51:11| Store logging disabled
> > 2012/01/20 09:51:11| User-Agent logging is disabled.
> > 2012/01/20 09:51:11| Referer logging is disabled.
> > 2012/01/20 09:51:11| DNS Socket created at [::], FD 6
> > ==4273== Syscall param epoll_ctl(event) points to uninitialised byte(s)
> > ==4273== at 0x4E1553E: epoll_ctl (in /lib/libc-2.12.2.so)
> > ==4273== by 0x1EF5DB: idnsInit (in /usr/sbin/squid)
> > ==4273== by 0x24DC09: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1F7372: AsyncCallT<EventDialer>::fire() (in /usr/sbin/squid)
> > ==4273== by 0x2A90C9: AsyncCall::make() (in /usr/sbin/squid)
> > ==4273== by 0x2ABA46: AsyncCallQueue::fireNext() (in /usr/sbin/squid)
> > ==4273== by 0x2ABBD7: AsyncCallQueue::fire() (in /usr/sbin/squid)
> > ==4273== by 0x1F774F: EventLoop::dispatchCalls() (in /usr/sbin/squid)
> > ==4273== by 0x1F792C: EventLoop::runOnce() (in /usr/sbin/squid)
> > ==4273== by 0x1F7A7F: EventLoop::run() (in /usr/sbin/squid)
> > ==4273== by 0x24E702: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273== Address 0xbe9f12fc is on thread 1's stack
> > ==4273== Uninitialised value was created by a stack allocation
> > ==4273== at 0x1DE161: commSetSelect (in /usr/sbin/squid)
> > ==4273==
> > 2012/01/20 09:51:11| DNS Socket created at 0.0.0.0, FD 7
> > ==4273== Syscall param epoll_ctl(event) points to uninitialised byte(s)
> > ==4273== at 0x4E1553E: epoll_ctl (in /lib/libc-2.12.2.so)
> > ==4273== by 0x1EF43D: idnsInit (in /usr/sbin/squid)
> > ==4273== by 0x24DC09: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1F7372: AsyncCallT<EventDialer>::fire() (in /usr/sbin/squid)
> > ==4273== by 0x2A90C9: AsyncCall::make() (in /usr/sbin/squid)
> > ==4273== by 0x2ABA46: AsyncCallQueue::fireNext() (in /usr/sbin/squid)
> > ==4273== by 0x2ABBD7: AsyncCallQueue::fire() (in /usr/sbin/squid)
> > ==4273== by 0x1F774F: EventLoop::dispatchCalls() (in /usr/sbin/squid)
> > ==4273== by 0x1F792C: EventLoop::runOnce() (in /usr/sbin/squid)
> > ==4273== by 0x1F7A7F: EventLoop::run() (in /usr/sbin/squid)
> > ==4273== by 0x24E702: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273== Address 0xbe9f12fc is on thread 1's stack
> > ==4273== Uninitialised value was created by a stack allocation
> > ==4273== at 0x1DE161: commSetSelect (in /usr/sbin/squid)
> > ==4273==
> > 2012/01/20 09:51:11| Adding nameserver 192.168.38.2 from /etc/resolv.conf
> > 2012/01/20 09:51:11| Accepting HTTP connections at [::]:3128, FD 9.
> > 2012/01/20 09:51:11| HTCP Disabled.
> > 2012/01/20 09:51:12| Loaded Icons.
> > 2012/01/20 09:51:12| Ready to serve requests.
> > .
> > .
> > .
> > .
> > ==4273== by 0x2ABA46: AsyncCallQueue::fireNext() (in /usr/sbin/squid)
> > ==4273== by 0x2ABBD7: AsyncCallQueue::fire() (in /usr/sbin/squid)
> > ==4273== by 0x1F774F: EventLoop::dispatchCalls() (in /usr/sbin/squid)
> > ==4273== by 0x1F792C: EventLoop::runOnce() (in /usr/sbin/squid)
> > ==4273== by 0x1F7A7F: EventLoop::run() (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 148 bytes in 1 blocks are possibly lost in loss record 953 of 1,207
> > ==4273== at 0x4824F1B: calloc (vg_replace_malloc.c:418)
> > ==4273== by 0x35734B: xcalloc (in /usr/sbin/squid)
> > ==4273== by 0x350C8D: MemPoolMalloc::allocate() (in /usr/sbin/squid)
> > ==4273== by 0x34ECC2: MemImplementingAllocator::alloc() (in /usr/sbin/squid)
> > ==4273== by 0x1B4943: cbdataInternalAlloc(cbdata_type) (in /usr/sbin/squid)
> > ==4273== by 0x1A70FA: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1A71E7: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AC9D9: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AE499: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AF445: parseConfigFile(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x24E1FB: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 176 bytes in 2 blocks are possibly lost in loss record 956 of 1,207
> > ==4273== at 0x4824F1B: calloc (vg_replace_malloc.c:418)
> > ==4273== by 0x35734B: xcalloc (in /usr/sbin/squid)
> > ==4273== by 0x350C8D: MemPoolMalloc::allocate() (in /usr/sbin/squid)
> > ==4273== by 0x34ECC2: MemImplementingAllocator::alloc() (in /usr/sbin/squid)
> > ==4273== by 0x34F8B9: MemAllocatorProxy::alloc() (in /usr/sbin/squid)
> > ==4273== by 0x2C6033: ??? (in /usr/sbin/squid)
> > ==4273== by 0x2C77FD: acl_ip_data::FactoryParse(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x2C7904: ACLIP::parse() (in /usr/sbin/squid)
> > ==4273== by 0x2E2AEA: ACL::ParseAclLine(ConfigParser&, ACL**) (in /usr/sbin/squid)
> > ==4273== by 0x1ACAAE: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AE499: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AF445: parseConfigFile(char const*) (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 180 bytes in 5 blocks are possibly lost in loss record 961 of 1,207
> > ==4273== at 0x4824F1B: calloc (vg_replace_malloc.c:418)
> > ==4273== by 0x35734B: xcalloc (in /usr/sbin/squid)
> > ==4273== by 0x350C8D: MemPoolMalloc::allocate() (in /usr/sbin/squid)
> > ==4273== by 0x34ECC2: MemImplementingAllocator::alloc() (in /usr/sbin/squid)
> > ==4273== by 0x24FAA8: memAllocString (in /usr/sbin/squid)
> > ==4273== by 0x277C43: String::allocBuffer(unsigned int) (in /usr/sbin/squid)
> > ==4273== by 0x277F3A: String::allocAndFill(char const*, int) (in /usr/sbin/squid)
> > ==4273== by 0x277FD4: String::reset(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x278009: String::operator=(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x23CB92: httpHeaderBuildFieldsInfo (in /usr/sbin/squid)
> > ==4273== by 0x233D28: httpHdrScInitModule() (in /usr/sbin/squid)
> > ==4273== by 0x2365E1: httpHeaderInitModule (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 202 bytes in 7 blocks are possibly lost in loss record 967 of 1,207
> > ==4273== at 0x4825BDC: malloc (vg_replace_malloc.c:195)
> > ==4273== by 0x35750C: xmalloc (in /usr/sbin/squid)
> > ==4273== by 0x357677: xstrdup (in /usr/sbin/squid)
> > ==4273== by 0x2CC67F: aclParseAccessLine(ConfigParser&, acl_access**) (in /usr/sbin/squid)
> > ==4273== by 0x19F374: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1ACC8F: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AE499: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1AF445: parseConfigFile(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x24DB4C: ??? (in /usr/sbin/squid)
> > ==4273== by 0x1F7372: AsyncCallT<EventDialer>::fire() (in /usr/sbin/squid)
> > ==4273== by 0x2A90C9: AsyncCall::make() (in /usr/sbin/squid)
> > ==4273== by 0x2ABA46: AsyncCallQueue::fireNext() (in /usr/sbin/squid)
> > .
> > .
> > .
> > .
> > ==4273== 2,700 bytes in 75 blocks are possibly lost in loss record 1,102 of 1,207
> > ==4273== at 0x4824F1B: calloc (vg_replace_malloc.c:418)
> > ==4273== by 0x35734B: xcalloc (in /usr/sbin/squid)
> > ==4273== by 0x350C8D: MemPoolMalloc::allocate() (in /usr/sbin/squid)
> > ==4273== by 0x34ECC2: MemImplementingAllocator::alloc() (in /usr/sbin/squid)
> > ==4273== by 0x24FAA8: memAllocString (in /usr/sbin/squid)
> > ==4273== by 0x277C43: String::allocBuffer(unsigned int) (in /usr/sbin/squid)
> > ==4273== by 0x277F3A: String::allocAndFill(char const*, int) (in /usr/sbin/squid)
> > ==4273== by 0x277FD4: String::reset(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x278009: String::operator=(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x23CB92: httpHeaderBuildFieldsInfo (in /usr/sbin/squid)
> > ==4273== by 0x236665: httpHeaderInitModule (in /usr/sbin/squid)
> > ==4273== by 0x24D569: ??? (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 3,004 bytes in 1 blocks are possibly lost in loss record 1,104 of 1,207
> > ==4273== at 0x4825BDC: malloc (vg_replace_malloc.c:195)
> > ==4273== by 0x35750C: xmalloc (in /usr/sbin/squid)
> > ==4273== by 0x23CA9F: httpHeaderBuildFieldsInfo (in /usr/sbin/squid)
> > ==4273== by 0x236665: httpHeaderInitModule (in /usr/sbin/squid)
> > ==4273== by 0x24D569: ??? (in /usr/sbin/squid)
> > ==4273== by 0x24E663: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 3,207 bytes in 176 blocks are definitely lost in loss record 1,107 of 1,207
> > ==4273== at 0x4825BDC: malloc (vg_replace_malloc.c:195)
> > ==4273== by 0x35750C: xmalloc (in /usr/sbin/squid)
> > ==4273== by 0x357677: xstrdup (in /usr/sbin/squid)
> > ==4273== by 0x25458D: MimeIcon::setName(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x2551D2: mimeInit (in /usr/sbin/squid)
> > ==4273== by 0x24DA63: ??? (in /usr/sbin/squid)
> > ==4273== by 0x24E663: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 14,119 bytes in 176 blocks are definitely lost in loss record 1,158 of 1,207
> > ==4273== at 0x4825BDC: malloc (vg_replace_malloc.c:195)
> > ==4273== by 0x35750C: xmalloc (in /usr/sbin/squid)
> > ==4273== by 0x357677: xstrdup (in /usr/sbin/squid)
> > ==4273== by 0x2545AA: MimeIcon::setName(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x2551D2: mimeInit (in /usr/sbin/squid)
> > ==4273== by 0x24DA63: ??? (in /usr/sbin/squid)
> > ==4273== by 0x24E663: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273==
> > ==4273== 478,537 (356 direct, 478,181 indirect) bytes in 1 blocks are definitely lost in loss record 1,207 of 1,207
> > ==4273== at 0x4825BDC: malloc (vg_replace_malloc.c:195)
> > ==4273== by 0x4A84B9E: ??? (in /usr/lib/libcrypto.so.1.0.0)
> > ==4273== by 0x4A851F8: CRYPTO_malloc (in /usr/lib/libcrypto.so.1.0.0)
> > ==4273== by 0x4A28EF5: SSL_CTX_new (in /usr/lib/libssl.so.1.0.0)
> > ==4273==
> > by 0x26E32C: sslCreateClientContext(char const*, char const*, int, char
> > const*, char const*, char const*, char const*, char const*, char
> > const*) (in /usr/sbin/squid)
> > ==4273== by 0x1AF8D3: parseConfigFile(char const*) (in /usr/sbin/squid)
> > ==4273== by 0x24E1FB: SquidMain(int, char**) (in /usr/sbin/squid)
> > ==4273== by 0x24EDCE: main (in /usr/sbin/squid)
> > ==4273==
> > ==4273== LEAK SUMMARY:
> > ==4273== definitely lost: 17,924 bytes in 365 blocks
> > ==4273== indirectly lost: 478,537 bytes in 16,390 blocks
> > ==4273== possibly lost: 11,378 bytes in 231 blocks
> > ==4273== still reachable: 3,027,964 bytes in 26,298 blocks
> > ==4273== suppressed: 0 bytes in 0 blocks
> > ==4273== Reachable blocks (those to which a pointer was found) are not shown.
> > ==4273== To see them, rerun with: --leak-check=full --show-reachable=yes
> >
> > Please help me.
>
                                               
Received on Sat Jan 21 2012 - 14:35:19 MST

This archive was generated by hypermail 2.2.0 : Sat Jan 21 2012 - 12:00:02 MST