Amos Jeffries [Thu, 31 Oct 2013 19:13:17 +0000 (13:13 -0600)]
Drop String::undefined()
It appears that all code using String::undefined() for boolean tests can
remain logically consistent using checks on string size() instead.
This helps by removing part of the
undefined-empty/defined-empty/0-length-empty string state
differentiation.
Alex Rousskov [Thu, 31 Oct 2013 16:22:17 +0000 (10:22 -0600)]
Avoid "hot idle": A series of rapid select() calls with zero timeout.
Squid uses "infinite" precision when it comes to deciding whether the next
timed event is ready but uses millisecond (1e-3) precision when deciding how
long to wait before the next event will be ready. This inconsistency results
in the EventScheduler engine telling the main loop that it has 0 milliseconds
to poll pending I/O, but when asked again (after the I/O is quickly polled),
the EventScheduler engine often does not schedule the promised event and tells
the main loop to poll for another 0 milliseconds again. This cycling may
happen many times in a row (until enough time is wasted for the next event to
become ready using higher precision).
The fixed code adds a minimum 1ms delay for not-yet-ready events. It also
places both decisions into one method (EventScheduler::timeRemaining), and
tries to polish/document decision logic (which is more complex than it may
seem) because the code has to avoid both inconsistent decisions and hot idle
loops while maintaining the traditional "no event is fired before it is due"
guarantee.
TODO: Idle Squid still runs hotter than it should because the maximum waiting
time is artificially capped outside the event queue to EVENT_LOOP_TIMEOUT=1s.
This causes at most one extra loop iteration per second.
Amos Jeffries [Sun, 27 Oct 2013 05:08:49 +0000 (22:08 -0700)]
Receive annotations from authentication helpers
This saves the kv-pair from authentication helper responses as
annotations on the HttpRequest which was authenticated and pass
on from there to logging.
Added a method appendNewOnly() to ensure duplicate-free addition
to a NotePairs list.
Also, fixes a bug in hasPair() accessor which was returning true
if either the key OR the value matched.
ie. hasPair("a","1") would match true for notes "a=2 b=1"
This uses the include ordering sort script to enforce blocks of include
statements being in alphasymbolic order with squid.h at teh top if it is
present.
Amos Jeffries [Sun, 13 Oct 2013 17:55:11 +0000 (10:55 -0700)]
Add cache_miss_revalidate
Port of 2.7 ignore_ims_on_miss directive.
This on/off switch enables Squid to convert conditional requests from
clients to non-conditional fetches that can fill the cache faster under
cold-start conditions.
Alex Rousskov [Mon, 14 Oct 2013 20:11:13 +0000 (14:11 -0600)]
Bug 3480: StoreEntry::kickProducer() segfaults in store_client::copy() context
Short-term fix: Lock StoreEntry object so that it is not freed by
storeClientCopy2() callbacks. Also lock StoreEntry in storeUnregister()
context because an aborting entry may be deleted there unless it is
double-locked.
See bug 3480 comment #27 for detailed call stack analysis. Additional cases
include rejected copied HIT due to Var mismatch and hits blocked by
reply_from_cache directive (under development; see bug 3937).
Long-term, we need to make store copying asynchronous and revise StoreEntry
locking approach.
Amos Jeffries [Wed, 9 Oct 2013 14:04:57 +0000 (08:04 -0600)]
Fix CBDATA_CLASS2 macro definition
CBDATA_UNKNOWN was being used in place of a void no-op statement.
This was incorrect and useless. Now that the value definition is fixed
it is being picked up by the stricter compilers.
Replace the trinary conditional with an if-statement.
Amos Jeffries [Wed, 9 Oct 2013 14:02:57 +0000 (08:02 -0600)]
Fix PosToString duplicate definiton
Since SBuf::size_type and std::string::size_type are now both unsigned
and npos is the same value in both this function is a duplicate and
the stricter compilers complain.