Changes in Varnish Cache 9.1
For information about updating your current Varnish deployment to the new version, see Upgrading to Varnish 9.1.
A more detailed and technical account of changes in Varnish Cache, with links to issues that have been fixed and pull requests that have been merged, may be found in the change log.
varnishd#
Parameters#
-
varnishd -x parameter-jsonhas been added to output the parameter documentation in JSON format. (4378) -
varnishdnow checks for an already running instance before modifying the working directory.-Cshould not be used together with-n. -
The
esi_ignore_https,esi_disable_xml_check,esi_ignore_other_elementsandesi_remove_bomfeature flags can now be overridden per response with the newberesp.esi_ignore_https,beresp.esi_disable_xml_check,beresp.esi_ignore_other_elementsandberesp.esi_remove_bomvariables. (4518) -
Object references are now retained until the end of a client task, such that object attributes accessed from VCL remain valid across restarts without being copied to the workspace. Consequently,
max_restartsandmax_retriesgained upper limits of 32766 and 65534, respectively. (4269) -
storage.Synth, as configured through the-sSynth=...varnishdstartup parameter is now the defaultresp.storageused for synthetic responses created invcl_synth{}. (4492) -
The lock witness facility is now disabled at compile time by default and needs to be enabled with the
--enable-witnessconfigureoption. (4574). Note that even if enabled at compile time, it still also needs to be activated at runtime usingparam.set debug +witnessas before.
Protocol framing fixes:#
HTTP/1 message framing checks have been tightened (4581):
- Backend responses with invalid body framing now fail the fetch.
- Multiple
Transfer-Encodingfields are now considered as a whole, such that duplicatechunkedcodings are refused. - Multiple
Content-Lengthfields and values are now accepted if they all agree (leading zeroes are tolerated) and consolidated into a single canonical header, any disagreement is refused. Transfer-Encodingon an HTTP/1.0 request is now refused. For HTTP/1.0 backend responses, the newvcl_beresp_http10built-in subroutine abandons the fetch, which VCL can override.- The backend connection is now closed when the range check of a response fails, to avoid reusing a connection with an unread body.
- An existing, correct
Connectionresponse header is no longer overwritten when closing: other tokens are preserved andcloseorkeep-aliveare added as needed. If aConnectionwas not present, or was incorrect, we create a new, correct one. (4498)
Other HTTP-related improvements#
-
HTTP header parsing now only accepts SP and TAB as optional white space. (4583)
-
Range processing is now only applied to
GETrequests as mandated by RFC 9110, and the builtin VCL removes theRangeheader from other requests. (4533) -
Fetching of HTTP/1.1 chunked bodies has been optimized: Chunked body fetches now use readahead instead of the previous single byte read operations which were wasteful and inefficient. (4508)
-
Improved support for delivery processors (VDPs) changing the length of a request body:
Content-Lengthis rewritten or removed and chunked encoding is used as required. -
The range VDP now removes any existing
Content-Rangeheader to avoid duplicates. -
A deficiency in HTTP/2 request parsing has been fixed by properly comparing pseudo-header names instead of doing a prefix match. (VSV00019)
-
Handling of
Connection: closehas been made more consistent if theConnectionheader also contains other tokens. (4495)
Ban improvements#
- The
obj.hfm,obj.hfp, andobj.uncacheableban variables have been added to allow banning hit-for-miss and hit-for-pass and uncachable (both) objects. (4532)
Synth storage engine#
- A new
synthstorage engine has been added, which avoids copying data for synthetic response bodies by referencing the constituents directly. It is used by default as theSynthstorage. (4365)
VCC fixes#
- VCC now refuses empty quoted header names as in
req.http."", which could previously result in a C compiler error. (4577) - Fixed a VCC bug where
includeof a BLOB literal file could fail with a spurious "Missing colon" error.
Build and compile-related improvements#
-
make installnow honoursDESTDIRwhen creatingVARNISH_STATE_DIR. (4512) -
During build, the new
configureoption--with-statedirnow allows to set theVARNISH_STATE_DIRdirectly, which is the default forVARNISH_DEFAULT_N, which, in turn, is the default for the-nargument tovarnishdandvarnish{log,ncsa,hist,top}. (4483) -
The default for
VARNISH_STATE_DIRhas been changed back to${localstatedir}/varnish. (4483)
Other fixes & improvements#
-
Worker pool shutdown has been reworked: Acceptor tasks and waiters now terminate promptly, dying pools no longer starve queued tasks and worker threads are waited for before a pool is dismantled. The worker process now ignores
SIGUSR1, which is used internally to interrupt blockingaccept(2)calls. (4538). -
PROXY v2 parsing now validates the length of the CRC32C TLV, avoiding an out-of-bounds read. (4560)
-
Fixed the alphabet of the built-in base64 encoder used when converting BLOBs to strings. (4522)
-
Starting sub-processes has become faster on systems with a high file descriptor limit by only closing file descriptors which are actually open. (3891)
-
A previous fix regarding
false/truedefaults for VMOD functionBOOLarguments was incomplete and has been corrected. (4452) -
Fixed a manager abort when the worker process failed to cool a VCL being discarded, which also prevented
auto_restartfrom taking effect.
(4563)
-
Fixed a panic when a delivery processor (VDP) failed to initialize before allocating the private pointer. This changes the VDP api in that a VDP that returns non-zero from its
.init()callback will no longer see its.fini()method called, which implies that all failure scenarios during.init()must clean up any allocated data before returning. (4539) -
Fixed a bug in the
pollwaiter which could delay handling of events whose deadline had already passed. (4561) -
When the worker process terminates,
varnishdnow reports resource usage in theChild dies usr=%f sys=%fmessage,usrandsysbeing the "user" and "system" time used as reported bygetrusage(). -
Worker pools are now shut down during a worker process stop as initiated by
varnishadm stop. This improves shutdown speed by releasing VCL references earlier.
The behavior now matches that with the drop_pools experimental parameter set, which has been removed.
-
Failed objects no longer get added to LRU. (4428)
-
IPv4 compatible and IPv4 mapped IPv6 addresses now get rewritten to IPv4 addresses, which is relevant for ACL matches in particular. (4474)
-
A workspace buffer overflow vulnerability was fixed in the
.upper()and.lower()VCL string type methods. (VSV00020)
