Client side must stop reading when switching to a tunnel mode. The old code
called low-level commSetSelect to stop reading, but that left Comm tables in
an inconsistent state, with the client side reader callback still scheduled.
Squid would assert when the tunnel called comm_read with its own callback.
The bug is unrelated to half-closed connections despite halfClosedReader
mentioned in the assertion text. The assertion means "no more than one active
reader per FD".
Alex Rousskov [Fri, 16 Jul 2010 22:37:42 +0000 (16:37 -0600)]
Added debugging scripts that work with detailed cache.log
scripts/find-alive.pl: pinpoint objects that are still alive, to find leaks
scripts/trace-job.pl: find cache.log lines that correspond to a given job
scripts/trace-master.pl: trace jobs related to a single master transaction
The scripts require maintenance as the logging format changes, but
they often simplify debugging by extracting relevant information from
tons of poorly structured cache.log data.
Alex Rousskov [Tue, 13 Jul 2010 16:43:00 +0000 (10:43 -0600)]
Prevent memory leaks when cloning Range requests.
HttpRequest::range field was set to a new HttpHdrRange object twice:
once in HttpRequest::clone() and once in HttpRequest::hdrCacheInit()
called from clone().
Polished HttpReply::clone() to make sure HttpReply::hdrCacheInit()
does not use uninitialized HttpReply::sline field and to prevent
benign double-initialization of HttpReply::keep_alive.
Alex Rousskov [Wed, 7 Jul 2010 03:17:47 +0000 (21:17 -0600)]
Moved KidIdentifier to globals to make pinger happy.
Pinger and possibly other optional externals require KidIdentifier via
debugs(). Instead of making KidIdentifier global, we could add a "plugin" API
to add program-dependent stuff to debugs() and friends, but we should not add
that kind of complexity unless really necessary. We could also link pinger
with libipc.la but that will probably cause more problems with IPC
dependencies.
Alex Rousskov [Wed, 7 Jul 2010 00:45:34 +0000 (18:45 -0600)]
SMP support, part 1: Essential non-caching functionality.
Added workers squid.conf option to specify how many main Squid
processes to fork and maintain. Zero means old no-daemon mode.
One means the old non-SMP mode.
Added support for process_name and process_number macros and
if-statement conditionals in squid.conf. Search for .pre changes for
documented details. These features allow the admin to configure each
worker process differently if needed.
Support multiple workers listening on the same HTTP[S] port (port
sharing). This allows multiple workers to split the load without any
special rules.
Support or prohibit port sharing for WCCP, DNS, ICP, HTCP, SNMP, and
Ident protocols, depending on protocol-specific restrictions. Sharing is
implemented by registering listening socket descriptors with the
Coordinator process and obtaining them from the Coordinator as needed.
Here are protocol-specific notes:
WCCP: Restricted to the Coordinator process due to how WCCP works.
Workers do not need access to the WCCP code.
DNS: Done by each worker with no sharing. Fixed source ports not
supported unless each worker is given its own outgoing address
because we do not want to match outgoing queries and incoming
responses across processes.
SNMP: Workers share incoming and outgoing sockets.
ICP and HTCP _clients_: Cannot be supported in SMP environment
unless each process has its own address (i.e., unique IP address
and/or unique [ICP] port) because we do not want to match outgoing
queries and incoming responses across processes.
ICP and HTCP _servers_: share listening sockets.
Ident clients do not need to share sockets because they use
unique ports.
Support management signals (squid -k ...) in SMP mode, acting as a
single Squid instance.
Refork dying workers, similar to how we reforked dying process in
non-SMP daemon mode.
Alex Rousskov [Wed, 7 Jul 2010 00:22:37 +0000 (18:22 -0600)]
Do not stop testheaders.sh on the first error, to be compatible with
"make -k check".
If testheaders.sh stops on the first error, it becomes very difficult to
test your changes with "make check" when somebody else broke some other
code or when the checks reach src/cf_parser.h and fail.
TODO: stop on the first error unless running under "make -k check".
Bundle a slightly hacked version of libltdl/ltdl.h which does not use <>
for inclusion of its dependency files. This makes it portable to OS with
older libtool versions.