]> git.ipfire.org Git - thirdparty/squid.git/commit
Author: Manu Garg <manugarg@gmail.com>
authorhno <>
Sun, 24 Jun 2007 03:08:39 +0000 (03:08 +0000)
committerhno <>
Sun, 24 Jun 2007 03:08:39 +0000 (03:08 +0000)
commite7412b1c930f60835e9c32332fda96d6704cf22c
treef4c0c83b4822bc9c74817a7f30983c9d29e938f8
parent89f77e43f36bdbd636826c94085f9b5d882e473d
Author: Manu Garg <manugarg@gmail.com>
Bug #1968: Squid hangs occasionally when using DNS search paths

Squid 2.6 (tested with squid 2.6.1 and 2.6.5) hangs after running for some time
(could be from 5 min to 40 min on a busy server). Squid becomes unresponsive
and CPU usage becomes 90-100%. ltrace shows that it's continuously comparing
strings in an infinite loop:

strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1
strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1
strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1

The problem seems to be in the way squid's internal DNS system (dns_internal.c)
keeps record of looked up but not yet answered DNS queries. This bug is hit
specifically when multiple search paths are used in /etc/resolv.conf.

Squid caches all dns queries before sending them to avoid duplicate queries for
the same name. (look at: idnsCacheQuery(q) and hash_table *idns_lookup_hash, in
dns_internal.c). This mechanism works well unless multiple search paths are
defined in /etc/resolv.conf. When multiple dns search paths are defined, same
query object is modified and next search path is concatenated to it's name.
This query is cached again and resent.

Problem is that the query is not unlinked before being cached and thus linked
again. Only the key of hash object (that's actually name) changes this time;
object itself remains same. This corrupts the hash table of looked up queries.
src/dns_internal.cc