]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
9 years agoAccumulate fewer unknown-size responses to avoid overwhelming disks.
Alex Rousskov [Sun, 1 May 2016 21:37:52 +0000 (15:37 -0600)] 
Accumulate fewer unknown-size responses to avoid overwhelming disks.

Start swapping out an unknown-size entry as soon as size-based cache_dir
selection is no longer affected by the entry growth. If the entry
eventually exceeds the selected cache_dir entry size limits, terminate
the swapout.

The following description assumes that Squid deals with a cachable
response that lacks a Content-Length header. These changes should not
affect other responses.

Prior to these changes, StoreEntry::mayStartSwapOut() delayed swapout
decision until the entire response was received or the already
accumulated portion of the response exceeded the [global] store entry
size limit, whichever came first. This logic protected Store from
entries with unknown sizes. AFAICT, that protection existed for two
reasons:

* Incorrect size-based cache_dir selection: When cache_dirs use
  different min-size and/or max-size settings, Squid cannot tell which
  cache_dir the unknown-size entry belongs to and, hence, may select the
  wrong cache_dir.

* Disk bandwidth/space waste: If the growing entry exceeds all cache_dir
  max-size limits, the swapout has to be aborted, resulting in waste of
  previously spent resources (primarily disk bandwidth and space).

The cost of those protections include RAM waste (up to maximum cachable
object size for each of the concurrent unknown-size entry downloads) and
sudden disk overload (when the entire delayed entry is written to disk
in a large burst of write requests initiated from a tight doPages() loop
at the end of the swapout sequence when the entry size becomes known).
The latter cost is especially high because swapping the entire large
object out in one function call can easily overflow disker queues and/or
block Squid while the OS drains disk write buffers in an emergency mode.

FWIW, AFAICT, cache_dir selection protection was the only reason for
introducing response accumulation (trunk r4446). The RAM cost was
realized a year later (r4954), and the disk costs were realized during
this project.

This change reduces those costs by starting to swap out an unknown-size
entry ASAP, usually immediately. In most caching environments, most
large cachable entries should be cached. It is usually better to spend
[disk] resources gradually than to deal with sudden bursts [of disk
write requests]. Occasional jolts make high performance unsustainable.

This change does not affect size-based cache_dir selection: Squid still
delays swapout until future entry growth cannot affect that selection.
Fortunately, in most configurations, the correct selection can happen
immediately because cache_dirs lack explicit min-size and/or max-size
settings and simply rely on the *same-for-all* minimum_object_size and
maximum_object_size values.

We could make the trade-off between costly protections (i.e., accumulate
until the entry size is known) and occasional gradual resource waste
(i.e., start swapping out ASAP) configurable. However, I think it is
best to wait for the use case that requires such configuration and can
guide the design of those new configuration options.

Side changes:

* Honor forgotten minimum_object_size for cache_dirs without min-size in
  Store::Disk::objectSizeIsAcceptable() and fix its initial value to
  correctly detect a manually configured cache_dir min-size (which may
  be zero). However, the fixed bug is probably hidden by another (yet
  unfixed) bug: checkTooSmall() forgets about cache_dirs with min-size!

* Allow unknown-size objects into the shared memory cache, which code
  could handle partial writes (since collapsed forwarding changes?).

* Fixed Rock::SwapDir::canStore() handling of unknown-size objects. I do
  not see how such objects could get that far before, but if they could,
  most would probably be cached because the bug would hide the unknown
  size from Store::Disk::canStore() that declares them unstorable.

9 years agoBug 4509: EUI compile error on NetBSD
Leonardo Taccari [Sat, 30 Apr 2016 18:48:35 +0000 (06:48 +1200)] 
Bug 4509: EUI compile error on NetBSD

9 years agoShared memory corruption when storing multi-slot (>32KB) shm misses.
Alex Rousskov [Mon, 25 Apr 2016 23:04:05 +0000 (17:04 -0600)] 
Shared memory corruption when storing multi-slot (>32KB) shm misses.

This is a regression I introduced in trunk r14584 (Bug 7: Update
cached entries on 304 responses).

9 years agoCleanup: remove use of MEM_DLINK_NODE for custom link-list
Amos Jeffries [Mon, 25 Apr 2016 08:27:42 +0000 (20:27 +1200)] 
Cleanup: remove use of MEM_DLINK_NODE for custom link-list

... implementation and replaces it all with a std::queue.

Also, de-duplicates the *Dequeue() functions by merging them into helper
class as a single nextRequest() getter method.

9 years agoFix typo in rev.14651
Amos Jeffries [Fri, 22 Apr 2016 16:57:29 +0000 (04:57 +1200)] 
Fix typo in rev.14651

9 years agoCleanup: convert late initialized objects to MEMPROXY_CLASS
Amos Jeffries [Fri, 22 Apr 2016 11:39:23 +0000 (23:39 +1200)] 
Cleanup: convert late initialized objects to MEMPROXY_CLASS

Convert all the objects using the libmem "old API" for as-needed pools
to using the MEMPROXY_CLASS() API which is better designed for late
initialization.

9 years ago4.0.9 SQUID_4_0_9
Amos Jeffries [Wed, 20 Apr 2016 13:19:37 +0000 (01:19 +1200)] 
4.0.9

9 years agoPrep for 4.0.9 and 3.5.17
Amos Jeffries [Wed, 20 Apr 2016 12:10:08 +0000 (00:10 +1200)] 
Prep for 4.0.9 and 3.5.17

9 years agoFix several ESI element construction issues
Amos Jeffries [Tue, 19 Apr 2016 20:07:52 +0000 (08:07 +1200)] 
Fix several ESI element construction issues

* Do not wrap active logic in assert().

* Fix localbuf array bounds checking.

* Add Must() conditions to verify array writes will succeed

9 years agoDocs: add release notes for on_unsupported_protocol and request_start_timeout
Amos Jeffries [Tue, 19 Apr 2016 15:18:53 +0000 (03:18 +1200)] 
Docs: add release notes for on_unsupported_protocol and request_start_timeout

9 years agoBug 4495: Unknown SSL option SSL_OP_NO_TICKET
Amos Jeffries [Tue, 19 Apr 2016 10:40:05 +0000 (22:40 +1200)] 
Bug 4495: Unknown SSL option SSL_OP_NO_TICKET

9 years agoStop parsing response prefix after discovering an "HTTP/0.9" response.
Alex Rousskov [Mon, 18 Apr 2016 19:08:25 +0000 (13:08 -0600)] 
Stop parsing response prefix after discovering an "HTTP/0.9" response.

Otherwise, our "X-Transformed-From: HTTP/0.9" headers are going to
be ignored, and the rest of the received bytes are going to be parsed
(and modified!) as an HTTP/1 response header, followed by message body.

9 years agoPrevent %O use by deny_info leading to header smuggling
Amos Jeffries [Sun, 17 Apr 2016 11:49:54 +0000 (23:49 +1200)] 
Prevent %O use by deny_info leading to header smuggling

9 years agocachemgr.cgi: use dynamic MemBuf for internal content generation
Amos Jeffries [Sat, 16 Apr 2016 12:01:03 +0000 (00:01 +1200)] 
cachemgr.cgi: use dynamic MemBuf for internal content generation

Using a fixed size buffer limits how big content lines can be. Modern
HTTP is fast reaching the point where such limits are problematic.
Also fixes incorrect uses of snprintf() by removing them.

9 years agoHandshake Error: ccs received early
Christos Tsantilas [Thu, 14 Apr 2016 17:31:46 +0000 (20:31 +0300)] 
Handshake Error: ccs received early

Some servers cause an SSL handshake error with peek and splice.
The problem is related to the TLS Session Tickets extension handling. Squid
expects always a Tls Session Tickets extension, included in server hello
message, to assume that the ticket accepted and the session is a resumed
session, which is not always true.

This is a Measurement Factory project

9 years agoPartial revert of rev.14638
Amos Jeffries [Thu, 14 Apr 2016 12:01:02 +0000 (00:01 +1200)] 
Partial revert of rev.14638

It did not catch all cases of the SP it was intended to and the chunked
encoding parse will need significantly different changes pending IETF WG
discussions.

Keep the violationLevel() member, which will be useful in general.

9 years agoBug 4493: theObject->sharedMemorySize() == theSegment.size() exception
Alex Rousskov [Wed, 13 Apr 2016 22:36:12 +0000 (16:36 -0600)] 
Bug 4493: theObject->sharedMemorySize() == theSegment.size() exception

We should not expect the exact match because, as discovered during bug
3805 (r13947) fix, shared Segment::size() may exceed the originally
requested RAM amount due to stat() page rounding done by OSes like OS X.

Unfortunately, this rounding weakens the failed consistency check a lot.
TODO: Store the exact requested size and check against that as well.

9 years agoSourceFormat Enforcement
Source Maintenance [Tue, 12 Apr 2016 18:12:15 +0000 (18:12 +0000)] 
SourceFormat Enforcement

9 years agoBug 4492: Handle SP padded size in chunked encoding
Amos Jeffries [Tue, 12 Apr 2016 15:07:13 +0000 (03:07 +1200)] 
Bug 4492: Handle SP padded size in chunked encoding

9 years agoRemoved ServerOptions "partial copy" copy constructor.
Alex Rousskov [Mon, 11 Apr 2016 16:34:29 +0000 (10:34 -0600)] 
Removed ServerOptions "partial copy" copy constructor.

AFAICT, the default copy constructor should work and the removed
explicit constructor was not copying the staticContext member, for no
documented reason (that I could find). It was also unused [in my tests].

If the partial copy constructor was abused for something useful, then a
different approach should be found -- the one that does not violate the
standard copy constructor post-conditions.

9 years agoAvoid startup/shutdown crashes [by avoiding static non-POD globals].
Alex Rousskov [Mon, 11 Apr 2016 15:14:58 +0000 (09:14 -0600)] 
Avoid startup/shutdown crashes [by avoiding static non-POD globals].

Squid crashes on startup when the parent process exit()s after fork()ing
the kid process. Squid may also crash on shutdown after exiting main().

In both cases, the crashes are build- and environment-specific. Many
environments show no problems at all. Even disabling compiler
optimizations may prevent crashes. When crashes do happen, their
symptoms (e.g., backtrace) point to problems during destruction of
global objects, but the details point to innocent objects (e.g., PortCfg
or SSL_CTX).

In some environments, the following malloc error is printed on console
before the crash: "corrupted double-linked list".

This change replaces two StatHist globals used for SBuf statistics
collection with always-available singletons. The replaced globals could
be destructed before the last SBuf object using them, leading to memory
corruption (that would eventually crash Squid).

There are probably more such globals.

9 years agoAdd a new error page token for unquoted external ACL messages.
Nathan Hoad [Sun, 10 Apr 2016 04:31:51 +0000 (16:31 +1200)] 
Add a new error page token for unquoted external ACL messages.

This is useful for external ACLs that send back messages that contain
actual HTML.

This work is submitted on behalf of Bloomberg L.P.

9 years agoBug 4465: Header forgery detection leads to crash
Alex Rousskov [Sat, 9 Apr 2016 15:35:34 +0000 (03:35 +1200)] 
Bug 4465: Header forgery detection leads to crash

9 years agoFix shm_open error message after rev.14625
Amos Jeffries [Fri, 8 Apr 2016 07:35:47 +0000 (19:35 +1200)] 
Fix shm_open error message after rev.14625

9 years agoBug 4405: assertion failed: comm.cc:554: "Comm::IsConnOpen(conn)"
Christos Tsantilas [Thu, 7 Apr 2016 16:36:10 +0000 (19:36 +0300)] 
Bug 4405: assertion failed: comm.cc:554: "Comm::IsConnOpen(conn)"

 It is possible that the connection will be closed somewhere inside
"clientTunnelOnError" call, inside ConnStateData::fakeAConnectRequest which
is called by ConnStateData::clientTunnelOnError or inside spliceOnError()
while trying to splice(). In this case the callers should be informed to abort
imediatelly, but instead continues, and try to set timeout handler on closed
connection.

This patch:
  - Modify ConnStateData::fakeAConnectRequest and ConnStateData::splice methods     to return boolean and false on error.
  - Does not close the connection inside ConnStateData::fakeAConnectRequest but
    instead return false and allow callers to close the connection if required.

This is a Measurement Factory project

9 years agoBug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt
Amos Jeffries [Thu, 7 Apr 2016 13:10:28 +0000 (01:10 +1200)] 
Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt

9 years agoBug 4482: Solaris GCC 5.2 warning in src/ip/Intercept.cc
Carsten Grzemba [Thu, 7 Apr 2016 12:03:53 +0000 (00:03 +1200)] 
Bug 4482: Solaris GCC 5.2 warning in src/ip/Intercept.cc

9 years agoFix missing variable type after rev.14625
Amos Jeffries [Thu, 7 Apr 2016 11:12:09 +0000 (23:12 +1200)] 
Fix missing variable type after rev.14625

9 years agoFixed NotNode (!acl) naming: Terminate the name before strncat(name).
Alex Rousskov [Thu, 7 Apr 2016 00:08:06 +0000 (18:08 -0600)] 
Fixed NotNode (!acl) naming: Terminate the name before strncat(name).

The fix may reduce or even eliminate garbage in logged ACL names (at
least). The bug was exposed by valgrind's "Conditional jump or move
depends on uninitialised value(s)" error.

9 years agoBug 4483: ./configure garbles -Og option in CFLAGS
Carsten Grzemba [Wed, 6 Apr 2016 14:46:39 +0000 (02:46 +1200)] 
Bug 4483: ./configure garbles -Og option in CFLAGS

9 years agoauthor: Nathan Hoad <nathan@getoffmalawn.com>
Christos Tsantilas [Tue, 5 Apr 2016 09:43:47 +0000 (12:43 +0300)] 
author: Nathan Hoad <nathan@getoffmalawn.com>
Add chained certificates and signing certificate to peek-then-bumped connections.

The scenario this patch addresses is when Squid is configured with an
intermediate signing CA certificate, and clients have the root CA installed on
their machines. What happens is that the generated certificates come down with
an unknown issuer (the intermediate signing certificate), with no
intermediates, so they are rejected. By adding the configured certificate chain
as old client-first mode did, the intermediate and root certificates come down
as well, resulting in the issuer being identified and the connection being
established "securely".

This work is submitted on behalf of Bloomberg L.P.

9 years agoCleanup: remove xstrerror()
Amos Jeffries [Sun, 3 Apr 2016 23:41:58 +0000 (11:41 +1200)] 
Cleanup: remove xstrerror()

9 years ago4.0.8 SQUID_4_0_8
Amos Jeffries [Fri, 1 Apr 2016 21:03:15 +0000 (10:03 +1300)] 
4.0.8

9 years agoPrep for 4.0.8 and 3.5.16
Amos Jeffries [Fri, 1 Apr 2016 20:56:46 +0000 (09:56 +1300)] 
Prep for 4.0.8 and 3.5.16

9 years agoDocs: release notes for shared_memory_locking
Amos Jeffries [Fri, 1 Apr 2016 20:23:56 +0000 (09:23 +1300)] 
Docs: release notes for shared_memory_locking

9 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Apr 2016 18:12:14 +0000 (18:12 +0000)] 
SourceFormat Enforcement

9 years agoAdd reply_header_add directive
Nathan Hoad [Fri, 1 Apr 2016 17:54:10 +0000 (06:54 +1300)] 
Add reply_header_add directive

... for adding HTTP headers to reply objects as they are sent to the client.

 This work is submitted on behalf of Bloomberg L.P.

9 years agoDocs: release notes for server_pconn_for_nonretriable
Amos Jeffries [Fri, 1 Apr 2016 01:46:41 +0000 (14:46 +1300)] 
Docs: release notes for server_pconn_for_nonretriable

9 years agoDocs: release notes for collapsed_forwarding_shared_entries_limit
Amos Jeffries [Fri, 1 Apr 2016 01:42:36 +0000 (14:42 +1300)] 
Docs: release notes for collapsed_forwarding_shared_entries_limit

9 years agoBug 4438 pt2: Fix destructor sequence issues in old memory pools (partial)
Amos Jeffries [Fri, 1 Apr 2016 01:00:02 +0000 (14:00 +1300)] 
Bug 4438 pt2: Fix destructor sequence issues in old memory pools (partial)

9 years agoDo not expose TidyPointer internals. No functionality changes intended.
Alex Rousskov [Thu, 31 Mar 2016 23:33:45 +0000 (17:33 -0600)] 
Do not expose TidyPointer internals. No functionality changes intended.

9 years agoCacheManager::GetInstance should be static not local
Amos Jeffries [Thu, 31 Mar 2016 15:36:10 +0000 (04:36 +1300)] 
CacheManager::GetInstance should be static not local

9 years agoMark GetPool() for removal
Amos Jeffries [Thu, 31 Mar 2016 10:02:08 +0000 (23:02 +1300)] 
Mark GetPool() for removal

9 years agoMake CacheManager::GetInstance() work during early global initialization
Amos Jeffries [Wed, 30 Mar 2016 16:15:57 +0000 (05:15 +1300)] 
Make CacheManager::GetInstance() work during early global initialization

9 years agoSimplify MemPools::GetInstance()
Alex Rousskov [Wed, 30 Mar 2016 16:15:28 +0000 (05:15 +1300)] 
Simplify MemPools::GetInstance()

9 years agoBug 4312: Support disabling collapsed forwarding SMP cooperation
Dave Dykstra [Wed, 30 Mar 2016 11:55:02 +0000 (00:55 +1300)] 
Bug 4312: Support disabling collapsed forwarding SMP cooperation

9 years agoCleanup: Automatically remove duplicated #include lines.
Alex Rousskov [Tue, 29 Mar 2016 16:58:12 +0000 (10:58 -0600)] 
Cleanup: Automatically remove duplicated #include lines.

9 years agopinger: drop capabilities on Linux
Yuriy M. Kaminskiy [Tue, 29 Mar 2016 16:56:38 +0000 (05:56 +1300)] 
pinger: drop capabilities on Linux

On linux, it is possible to install pinger helper with only CAP_NET_RAW
raised instead of full setuid-root:

 (setcap cap_net_raw+ep /path/to/pinger && chmod u-s /path/to/pinger) || :

However, pinger only drops setuid/setgid, and won't drop capabilities
after sockets are opened (when it is setuid-root, setuid(getuid()) also
drops capabilities, no code changes necessary; however, if it is only
setcap'ed, setuid() is no-op).

Fix is minimally tested, seems to work fine with both/either `setcap`
and `chmod u+s`; non-linux/non-libcap configurations should not be
affected).

* Also fixes errno debug outputs.

9 years agoMerged from trunk rev.14612
Amos Jeffries [Tue, 29 Mar 2016 16:11:58 +0000 (05:11 +1300)] 
Merged from trunk rev.14612

9 years agoBug 4409 pt2: Fix krb5-config Heimdal detection
Amos Jeffries [Tue, 29 Mar 2016 15:23:51 +0000 (04:23 +1300)] 
Bug 4409 pt2: Fix krb5-config Heimdal detection

9 years agoRemoved duplicated #include line.
Alex Rousskov [Tue, 29 Mar 2016 14:46:57 +0000 (08:46 -0600)] 
Removed duplicated #include line.

9 years agoReturn a reference from GetStrPool()
Amos Jeffries [Tue, 29 Mar 2016 09:53:45 +0000 (22:53 +1300)] 
Return a reference from GetStrPool()

9 years agoRemove memPoolInUseCount() wrapper
Amos Jeffries [Tue, 29 Mar 2016 08:00:44 +0000 (21:00 +1300)] 
Remove memPoolInUseCount() wrapper

9 years agoUse Mem::Init() to initialize for GetPool()
Amos Jeffries [Tue, 29 Mar 2016 07:58:21 +0000 (20:58 +1300)] 
Use Mem::Init() to initialize for GetPool()

9 years agopinger: Fix select(2) to actually use max_fd
Yuriy M. Kaminskiy [Mon, 28 Mar 2016 23:06:36 +0000 (12:06 +1300)] 
pinger: Fix select(2) to actually use max_fd

9 years agopinger: Fix buffer overflow in Icmp6::Recv
Yuriy M. Kaminskiy [Mon, 28 Mar 2016 22:52:58 +0000 (11:52 +1300)] 
pinger: Fix buffer overflow in Icmp6::Recv

9 years agoFix MemPools::GetInstance() potential destruct sequence
Amos Jeffries [Mon, 28 Mar 2016 22:14:41 +0000 (11:14 +1300)] 
Fix MemPools::GetInstance() potential destruct sequence

9 years agoFix build issue in X-Accelerator-Vary
Amos Jeffries [Fri, 25 Mar 2016 21:03:30 +0000 (10:03 +1300)] 
Fix build issue in X-Accelerator-Vary

9 years agoConvert Vary handling to SBuf
Amos Jeffries [Fri, 25 Mar 2016 20:11:29 +0000 (09:11 +1300)] 
Convert Vary handling to SBuf

9 years agoDocs: update SPONSORS list
Amos Jeffries [Fri, 25 Mar 2016 13:06:34 +0000 (02:06 +1300)] 
Docs: update SPONSORS list

9 years agoFix memory leak of AccessLogentry::url
Nathan Hoad [Fri, 25 Mar 2016 13:03:30 +0000 (02:03 +1300)] 
Fix memory leak of AccessLogentry::url

 ... created by ACLFilledChecklist::syncAle().

::syncAle() is the only place in the codebase that assigns a URL that
AccessLogEntry is expected to free(), which AccessLogEntry doesn't do.
This results in a memory leak.

  This is submitted on behalf of Bloomberg L.P.

9 years agoBug 4438: SIGSEGV in memFreeString() destructing SBuf globals on shutdown/restart
Amos Jeffries [Fri, 25 Mar 2016 12:55:30 +0000 (01:55 +1300)] 
Bug 4438: SIGSEGV in memFreeString() destructing SBuf globals on shutdown/restart

9 years agoAdded shared_memory_locking configuration directive to control mlock(2).
Alex Rousskov [Thu, 24 Mar 2016 17:02:25 +0000 (11:02 -0600)] 
Added shared_memory_locking configuration directive to control mlock(2).

Locking shared memory at startup avoids SIGBUS crashes when kernel runs
out of RAM during runtime. Why not enable it by default? Unfortunately,
locking requires privileges and/or much-higher-than-default
RLIMIT_MEMLOCK limits. Thus, requiring locked memory by default is
likely to cause too many complaints, especially since Squid has not
required that before. The default is off, at least for now.

As we gain more experience, we may try to enable locking by default
while making default locking failures non-fatal and warning about
significant [accumulated] locking delays.

9 years agoReduce scope of MemIsInitialized
Amos Jeffries [Thu, 24 Mar 2016 10:12:23 +0000 (23:12 +1300)] 
Reduce scope of MemIsInitialized

9 years agoRemove useless SmallestStringBeforeMemIsInitialized
Amos Jeffries [Thu, 24 Mar 2016 09:18:33 +0000 (22:18 +1300)] 
Remove useless SmallestStringBeforeMemIsInitialized

9 years agoFully initialize string pools in GetStrPool()
Amos Jeffries [Thu, 24 Mar 2016 09:17:05 +0000 (22:17 +1300)] 
Fully initialize string pools in GetStrPool()

9 years agoAdd memFindStringSizeType() to simplify looking up a string pool
Amos Jeffries [Thu, 24 Mar 2016 08:35:05 +0000 (21:35 +1300)] 
Add memFindStringSizeType() to simplify looking up a string pool

9 years agoPolish: rename getStrPool to GetStrPool in coding guidelines
Amos Jeffries [Wed, 23 Mar 2016 18:19:39 +0000 (07:19 +1300)] 
Polish: rename getStrPool to GetStrPool in coding guidelines

9 years agoPolish: rename getPool to GetPool in coding guidelines
Amos Jeffries [Wed, 23 Mar 2016 18:15:24 +0000 (07:15 +1300)] 
Polish: rename getPool to GetPool in coding guidelines

9 years agoRemove unused static in old_api.cc
Francesco Chemolli [Wed, 23 Mar 2016 18:10:47 +0000 (19:10 +0100)] 
Remove unused static in old_api.cc

9 years agoRework string pools into accessor toe ensure initializaiton safety
Francesco Chemolli [Wed, 23 Mar 2016 17:56:24 +0000 (18:56 +0100)] 
Rework string pools into accessor toe ensure initializaiton safety

9 years agoconvert old_api.cc:MemPools to accessor method to ensure initialization order
Francesco Chemolli [Wed, 23 Mar 2016 17:43:07 +0000 (18:43 +0100)] 
convert old_api.cc:MemPools to accessor method to ensure initialization order

9 years agoMemPools::init is not implemented except in stubs
Francesco Chemolli [Wed, 23 Mar 2016 16:29:47 +0000 (17:29 +0100)] 
MemPools::init is not implemented except in stubs

9 years agoBring MemPools::instance as a static variable in GetInstance() to force initializatio...
Francesco Chemolli [Wed, 23 Mar 2016 11:36:59 +0000 (12:36 +0100)] 
Bring MemPools::instance as a static variable in GetInstance() to force initialization order

9 years agoFixed build broken by r14601: Use trunk, not v3.5 ID for Cache-Control.
Alex Rousskov [Mon, 21 Mar 2016 04:48:44 +0000 (22:48 -0600)] 
Fixed build broken by r14601: Use trunk, not v3.5 ID for Cache-Control.

9 years agoBug 2831: Cache-control: max-age not sent on TCP_IMS_HIT/304
Dave Dykstra [Sun, 20 Mar 2016 16:20:28 +0000 (05:20 +1300)] 
Bug 2831: Cache-control: max-age not sent on TCP_IMS_HIT/304

9 years agoBug 4452: squid -z segfaults with ufs
Marcos Mello [Sun, 20 Mar 2016 12:00:54 +0000 (00:00 +1200)] 
Bug 4452: squid -z segfaults with ufs

9 years agoTests: remove GnuTLS from layer-02-maximus again
Amos Jeffries [Sun, 20 Mar 2016 11:49:15 +0000 (23:49 +1200)] 
Tests: remove GnuTLS from layer-02-maximus again

9 years agoTests: update test suite for GnuTLS
Amos Jeffries [Sat, 19 Mar 2016 12:52:42 +0000 (01:52 +1300)] 
Tests: update test suite for GnuTLS

9 years agoBug 4423: adding stdio: prefix to cache_log directive produces FATAL error
Amos Jeffries [Fri, 18 Mar 2016 12:05:14 +0000 (01:05 +1300)] 
Bug 4423: adding stdio: prefix to cache_log directive produces FATAL error

9 years agoBug 4459: move ssl_db into /var/cache/squid/
Marcos Mello [Fri, 18 Mar 2016 09:38:10 +0000 (22:38 +1300)] 
Bug 4459: move ssl_db into /var/cache/squid/

* auto-generates the man(8) page for this helper.

* moves the shared Makefile variables to Common.am

* updates the heper documentation to use the builds actual
  installed paths instead of hard-coding standard paths

9 years agoBug 4459: FHS compliance: move netdb.state to /var/cache/squid
Amos Jeffries [Fri, 18 Mar 2016 07:36:45 +0000 (20:36 +1300)] 
Bug 4459: FHS compliance: move netdb.state to /var/cache/squid

9 years agoCleanup: de-duplicate HttpRequest CreateFromUrl functions
Amos Jeffries [Thu, 17 Mar 2016 03:28:14 +0000 (16:28 +1300)] 
Cleanup: de-duplicate HttpRequest CreateFromUrl functions

9 years agoSourceFormat Enforcement
Source Maintenance [Tue, 15 Mar 2016 18:12:09 +0000 (18:12 +0000)] 
SourceFormat Enforcement

9 years agoassertion failed: Write.cc:41: "!ccb->active()"
Christos Tsantilas [Tue, 15 Mar 2016 12:43:09 +0000 (14:43 +0200)] 
assertion failed: Write.cc:41: "!ccb->active()"

Bug description:
   - The client side and server side are finished
   - On server side the Ftp::Relay::finalizeDataDownload() is called and
     schedules the Ftp::Server::originDataCompletionCheckpoint
   - On client side the "Ftp::Server::userDataCompletionCheckpoint" is
     called. This is schedules a write to control connection and closes
     data connection.
   - The Ftp::Server::originDataCompletionCheckpoint is called which is
     trying to write to control connection and the assertion triggered.

This bug is an corner case, where the client-side  (FTP::Server) should
wait for the server side (Ftp::Client/Ftp::Relay) to finish its job before
respond to the FTP client. In this bug the existing mechanism, designed
to handle such problems, did not worked correctly and resulted to a double
write response to the client.

This patch try to fix the existing mechanism as follows:

- When Ftp::Server receives a "startWaitingForOrigin" callback, postpones
  writting possible responses to the client and keeps waiting for the
  stopWaitingForOrigin callback

- When the Ftp::Server receives a "stopWaitingForOrigin" callback,
  resumes any postponed response.

- When the Ftp::Client starts working on a DATA-related transaction, calls the
  Ftp::Server::startWaitingForOrigin callback

- When the Ftp::Client finishes its job or when its abort abnormaly, checks
  whether it needs to call Ftp::Server::stopWaitingForOrigin callback.

- Also this patch try to fix the status code returned to the FTP client
  taking in account the status code returned by FTP server. The
  "Ftp::Server::stopWaitingForOrigin" is used to pass the returned status code
  to the client side.

This is a Measurement Factory project

9 years agoBug 4458: Squid 4 behaviour change with external ACL arguments
Amos Jeffries [Tue, 15 Mar 2016 06:22:49 +0000 (19:22 +1300)] 
Bug 4458: Squid 4 behaviour change with external ACL arguments

9 years agoDetect when a child method declaration hides parent's virtual method.
Alex Rousskov [Sun, 13 Mar 2016 04:47:19 +0000 (21:47 -0700)] 
Detect when a child method declaration hides parent's virtual method.

Adding -Woverloaded-virtual exposed one problem in the existing code.

9 years agoAuthor: Eduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Eduard Bagdasaryan [Sat, 12 Mar 2016 20:27:35 +0000 (13:27 -0700)] 
Author: Eduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Added ACL-driven server_pconn_for_nonretriable squid.conf directive.

This directive provides fine-grained control over persistent connection
reuse when forwarding HTTP requests that Squid cannot retry. It is
useful in environments where opening new connections is very expensive
and race conditions associated with persistent connections are very rare
and/or only cause minor problems.

9 years agoTrying to avoid "looser throw specifier" error with Wheezy GCC.
Alex Rousskov [Sat, 12 Mar 2016 18:40:29 +0000 (11:40 -0700)] 
Trying to avoid "looser throw specifier" error with Wheezy GCC.

AFAICT, the default CbdataParent destructor gets implicit
"noexcept(true)" specifier (because the default destructor does not
throw itself, and CbdataParent has no data members or parents that could
have contributed potentially throwing destructors). The AsyncJob child
uses a lot of things that might throw during destruction (the compiler
cannot tell for sure because we do not use noexcept specifiers). Thus,
the compiler has to use "noexcept(false)" specifier for ~AsyncJob, which
is "looser" that "noexcept(true)" for ~CbdataParent and, hence, violates
the parent interface AsyncJob is implementing/overriding.

I have doubts about the above analysis because many other compilers,
including GCC v5 and clang are happy with the default virtual
CbdataParent destructor. If my analysis is correct, then the rule of
thumb is: Base classes must not use "= default" destructors until all
our implicit destructors become "noexcept".

9 years agoImprove class declaration consistency a bit. No functionality changes.
Alex Rousskov [Sat, 12 Mar 2016 06:16:09 +0000 (23:16 -0700)] 
Improve class declaration consistency a bit. No functionality changes.

9 years agoUse CBDATA_CHILD() instead of CBDATA_CLASS() to mark overridden methods.
Alex Rousskov [Sat, 12 Mar 2016 06:04:03 +0000 (23:04 -0700)] 
Use CBDATA_CHILD() instead of CBDATA_CLASS() to mark overridden methods.

TODO: If this works across the build farm, convert other AsyncJob kids.

9 years agoFixed clang -Winconsistent-missing-override warning.
Alex Rousskov [Sat, 12 Mar 2016 05:01:46 +0000 (22:01 -0700)] 
Fixed clang -Winconsistent-missing-override warning.

AsyncJob classes can now use C++11 overrides as long as they use the new
CBDATA_CHILD() macro instead of old CBDATA_CLASS().

I have prohibited multiple CBDATA_CHILD() classes on the same
inheritance branch by adding the "final" specifier to toCbdata(). Such
classes feel dangerous because they may have different sizes and it is
not obvious to me whether the cbdata code will call the right size-
specific delete for them. We can easily relax this later if needed.

9 years agoBug 7: Update cached entries on 304 responses.
Alex Rousskov [Fri, 11 Mar 2016 18:00:51 +0000 (11:00 -0700)] 
Bug 7: Update cached entries on 304 responses.

New Store API to update entry metadata and headers on 304s.
Support entry updates in shared memory cache and rock cache_dirs.
No changes to ufs-based cache_dirs: Their entries are still not updated.

* Atomic StoreEntry metadata updating

   StoreEntry metadata (swap_file_sz, timestamps, etc.) is used
   throughout Squid code. Metadata cannot be updated atomically because
   it has many fields, but a partial update to those fields causes
   assertions. Still, we must update metadata when updating HTTP
   headers. Locking the entire entry for a rewrite does not work well
   because concurrent requests will attempt to download a new entry
   copy, defeating the very HTTP 304 optimization we want to support.

   Ipc::StoreMap index now uses an extra level of indirection (the
   StoreMap::fileNos index) which allows StoreMap control which
   anchor/fileno is associated with a given StoreEntry key. The entry
   updating code creates a disassociated (i.e., entry/key-less) anchor,
   writes new metadata and headers using that new anchor, and then
   _atomically_ switches the map to use that new anchor. This allows old
   readers to continue reading using the stale anchor/fileno as if
   nothing happened while a new reader gets the new anchor/fileno.

   Shared memory usage increase: 8 additional bytes per cache entry: 4
   for the extra level of indirection (StoreMapFileNos) plus 4 for
   splicing fresh chain prefix with the stale chain suffix
   (StoreMapAnchor::splicingPoint). However, if the updated headers are
   larger than the stale ones, Squid will allocate shared memory pages
   to accommodate for the increase, leading to shared memory
   fragmentation/waste for small increases.

* Revamped rock index rebuild process

   The index rebuild process had to be completely revamped because
   splicing fresh and stale entry slot chain segments implies tolerating
   multiple entry versions in a single chain and the old code was based
   on the assumption that different slot versions are incompatible. We
   were also uncomfortable with the old cavalier approach to accessing
   two differently indexed layers of information (entry vs. slot) using
   the same set of class fields, making it trivial to accidentally
   access entry data while using slot index.

   During the rewrite of the index rebuilding code, we also discovered a
   way to significantly reduce RAM usage for the index build map (a
   temporary object that is allocated in the beginning and freed at the
   end of the index build process). The savings depend on the cache
   size: A small cache saves about 30% (17 vs 24 bytes per entry/slot)
   while a 1TB cache_dir with 32KB slots (which implies uneven
   entry/slot indexes) saves more than 50% (~370MB vs. ~800MB).

   Adjusted how invalid slots are counted. The code was sometimes
   counting invalid entries and sometimes invalid entry slots. We should
   always count _slots_ now because progress is measured in the number
   of slots scanned, not entries loaded. This accounting change may
   surprise users with much higher "Invalid entries" count in cache.log
   upon startup, but at least the new reports are meaningful.

   This rewrite does not attempt to solve all rock index build problems.
   For example, the code still assumes that StoreEntry metadata fits a
   single slot which is not always true for very small slots.

9 years agoDocumented some of the Packable API problems.
Alex Rousskov [Fri, 11 Mar 2016 17:53:26 +0000 (10:53 -0700)] 
Documented some of the Packable API problems.

9 years agoDo not prohibit updating Last-Modified on 304 responses.
Alex Rousskov [Fri, 11 Mar 2016 17:52:03 +0000 (10:52 -0700)] 
Do not prohibit updating Last-Modified on 304 responses.

RFC 7232 Section 4.1 says sending Last-Modified in 304 might be useful
and RFC 7234 Section 4.3.3 requires updating all non-Warning headers.

9 years agoAdded missing const qualifiers to HTTP message packing methods.
Alex Rousskov [Fri, 11 Mar 2016 17:48:57 +0000 (10:48 -0700)] 
Added missing const qualifiers to HTTP message packing methods.

9 years agoRemoved SWAPOUT_WRITING assertion from storeSwapMetaBuild().
Alex Rousskov [Fri, 11 Mar 2016 17:24:13 +0000 (10:24 -0700)] 
Removed SWAPOUT_WRITING assertion from storeSwapMetaBuild().

I do not see any strong dependency of that code on that state and we
need to be able to build swap metadata when updating a stale entry
(which would not normally be in the SWAPOUT_WRITING state).

The biggest danger is that somebody calls storeSwapMetaBuild() when the
entry metadata is not yet stable. I am not sure we have a way of
detecting that without using something as overly strong as
SWAPOUT_WRITING.

9 years agoFix memory leak of lastAclData
Nathan Hoad [Fri, 11 Mar 2016 15:03:20 +0000 (04:03 +1300)] 
Fix memory leak of lastAclData

9 years agoCleanup: improved EUI debugging
Amos Jeffries [Thu, 10 Mar 2016 14:46:28 +0000 (03:46 +1300)] 
Cleanup: improved EUI debugging

9 years agoFix memory leak of HttpRequest objects
Nathan Hoad [Thu, 10 Mar 2016 06:55:17 +0000 (19:55 +1300)] 
Fix memory leak of HttpRequest objects