]> git.ipfire.org Git - thirdparty/squid.git/commit - src/adaptation/icap/ModXact.h
Bug #1974 fix: Bypass failures of optional ICAP services.
authorrousskov <>
Wed, 20 Jun 2007 03:12:15 +0000 (03:12 +0000)
committerrousskov <>
Wed, 20 Jun 2007 03:12:15 +0000 (03:12 +0000)
commit478cfe99eccf60060ca4fdec9ccdd2f37da24d4a
treeb488d21ab65e673a64c82e993f3da2877efeb44c
parentcfc684056b06a337844889663f0d0fadc1af9c33
Bug #1974 fix: Bypass failures of optional ICAP services.

To bypass various failures, ICAPModXact catches its own exceptions and enables
the "echo" mode instead of quitting. Exceptions are not overruled if the
transaction is retriable. The code disables bypass for essential ICAP services
and when something makes clean echoing impossible (e.g., some buffered HTTP
body content was consumed).

This design allows the same bypass mechanism to be used for moth REQMOD and
RESPMOD, regardless of the vectoring point. Its implementation did not require
changing any Squid core files.

Previously many if not most ICAP failures were not bypassed and users were
receiving cryptic "ICAP protocol error" messages when an optional ICAP
service went down. With the current code, the service may go up and down many
times but only the transactions with large message bodies (that were executing
when the service went down) should be affected.

When deciding on whether to consume HTTP content written to the ICAP server,
Squid has to resolve a trade-off: postponing consumption longer increases
process footprint and may slow the HTTP side down, but consuming sooner
increases the chance of that "ICAP protocol" error being returned to the user.
Since Squid cannot buffer very large messages, some errors are inevitable. We
may want to add knobs to control this tradeoff.

The entries below are only indirectly related to the bug #1974 fix.

virginConsume() does not call or imply checkConsuming(). We must call
checkConsuming() even if we called virginConsume(). Otherwise, we may leave
and get destroyed while the pipe object still holds a [consumer] pointer to
us.

Polished VirginBodyAct so that we can distinguish disabled from undecided
states without using magical negative size constants.

Do not stop writing before throwing an exception. If the exception kills the
transaction, the transaction should cleanup the writer anyway. To bypass an
exception, we need all virgin content intact. Stopping writes before throwing
an exception may consume virgin content because the code does not know that
the exception is about to be thrown and may perceive content as "no longer
needed".

Added debugging.

Merged from the squid3-icap branch.
src/ICAP/ICAPModXact.cc
src/ICAP/ICAPModXact.h