This document contains notes from the Varnish developers about ongoing development and past versions:
Official information about changes in releases and advise on the upgrade process can be found in the doc/sphinx/whats-new/ directory, also available in HTML format at http://varnish-cache.org/docs/trunk/whats-new/index.html and via individual releases. These documents are updated as part of the release process.
Timestamps for http/2 requests have been corrected and made similar to how they are taken for http/1.
For http/1, the start time, internally called "t_first", is taken as soon as any part of the request (headers) is received. Previously, http/2 took it later, possibly much later if long header lines were involved. http/2 now takes it the same way as http/1 when the first bit of the first HEADERS frame of the request arrives.
Timing behavior for http/1 and http/2 is different and can not be directly compared. But with this change, the Timestamp VSL records for http/2 now at least reflect reality better.
NOTE that after upgrading Varnish-Cache, processing and response times for http/2 will now be reported as worse than before the upgrade, potentially much worse. This is NOT a performance regression, but rather due to the corrected timestamps, which arguably were wrong for http/2. (4282)
An issue has been fixed which could cause a crash when varnishd receives an invalid Content-Range header from a backend. (4276)
The hitmiss and hitpass handling indicators have been added to the Varnish:handling format of varnishncsa.
All bitfield parameters (like feature or vsl_mask) now support the special values all and none.
The output format of varnishadm param.show has been adjusted accordingly.
Behavior of the VCL include statement with the +glob option has been clarified to not search directories in vcl_path. Using +glob includes with a relative path that does not start with "./" will now result in a VCL compile failure.
The linux jail gained control of transparent huge pages (THP) settings: The transparent_hugepage suboption can be set to ignore to do nothing, enable to enable THP (actually, disable the disable), disable to disable THP or try-disable to try do disable, but not emit an error if disabling fails. try-disable is the default.
The new ban_any_variant parameter allows to configure the maximum number of possibly non matching variants evaluated against the ban list during lookup. The default value of 10000 avoids excessive time spent for ban checks during lookups, which could cause noticeable delays for cases with a very high number of bans and/or variants (in the 1000s).
Setting ban_any_variant to 0 changes the behavior of the lookup-time ban check to only consider matching objects for tests against the ban list, which can be considered a bugfix, depending on the exact interpretation of the semantics of ban expressions with regards to variants. 0 will become the new default in a future release of Varnish-Cache. (4253)
varnishncsa now handles headers unset and changed from VCL more consistently: request headers are logged as they were received from the client and as they were sent to the backend, while response headers are logged as they were sent to the client and as they were received from the backend (3528)
Two fields have been added to the VMOD data registered with varnish-cache:
The panic output and the debug.vmod CLI command output now contain these identifiers.
Where supported by the compiler and linker, the vcs identifier is also reachable via the .vmod_vcs section of the vmod shared object ELF file and can be extracted, for example, using readelf -p.vmod_vcs <file>
vmodtool.py now creates a file vmod_vcs_version.txt in the current working directory when called from a git tree. This file is intended to transport version control system information to builds from distribution bundles.
vmod authors should add it to the distribution and otherwise ignore it for SCM.
Where git and automake are used, this can be accomplished by adding vmod_vcs_version.txt to the .gitignore file and to the EXTRA_DIST and DISTCLEANFILES variables in Makefile.am.
If neither git is used nor vmod_vcs_version.txt present, vmodtool.py will add NOGIT to the vmod as the vcs identifier.
vmodtool.py now accepts a $Version stanza in vmod vcc files to set the vmod version as registered with Varnish-Cache. If $Version is not present, an attempt is made to extract PACKAGE_STRING from an automake Makefile, otherwise NOVERSION is used as the version identifier.
Connection pools are now cleaned up asynchronously.
A concurrency issue in the backend connection queuing feature as configured through the backend_wait_* parameters and wait_* backend attributes has been fixed which could lead to under-utilization of the allowed number of backend connections. (4233)
An edge case in director handling has been fixed which could lead to premature retirement of backends during assignments.
A new facility has been added allowing transport delivery functions to disembark the worker thread which had been handling a request's VCL code during delivery by returning VTR_D_DISEMBARK from the vtr_deliver_f function.
This will enable future optimizations to make transport protocol code more efficient.
To enable this facility, a new request processing step finish has been added once delivery is complete.
VCL now supports unset req.grace and unset req.ttl to reset the respective variables to the "no effect" value, which is also the default.
The scope of VCL variables req.is_hitmiss and req.is_hitpass is now restricted to vcl_miss, vcl_deliver, vcl_pass, vcl_synth and vcl_pass, vcl_deliver, vcl_synth respectively.
The Varnish Delivery Processor (VDP) filter API has been generalized to also accommodate future use for backend request bodies:
VDP_Init() gained a struct busyobj * argument for use of VDPs on the backend side, which is mutually exclusive with the existing struct req * argument (one of the two needs to be NULL). VDP_Init() also gained an intmax_t * pointer, which needs to point to the known content length of the body data or -1 for "unknown length". Filters can change this value.
struct vdp_ctx lost the req member, but gained struct objcore *oc, struct http *hp and intmax_t *clen members. The rationale here is that a VDP should be concerned mainly with transforming body data (for which clen is relevant) and optionally changing (from the vdp_init_f) the headers sent before the body data, for which hp is intended. Some VDPs also work directly on a struct objcore *, so oc is provided to the first VDP in the chain only.
Generic VDPs should specifically not access the request or be concerned with the object.
Yet special purpose VDPs still can take from VRT_CTX whatever references they need in the vdp_init_f and store them in their private data.
Consequent to what as been explained above, vdp_init_f lost its struct objcore * argument.
VDPs with no vdp_bytes_f function are now supported if the vdp_init_f returns a value greater than zero to signify that the filter is not to be added to the chain. This is useful to support VDPs which only need to work on headers.
The epoll and kqueue waiters have been improved to correctly report WAITER_REMCLOSE, which increases the WAITER.*.remclose counter.
varnishtest now supports the shutdown command corresponding to the shutdown(2) standard C library call.
VSC counters for waiters have been added:
These can be found under WAITER.<poolname>..
The port of a listen_endpoint given with the -a argument to varnishd can now also be a numerical port range like 80-89, besides the existing options of port number (e.g. 80) and service name (e.g. http). With a port range, Varnish will accept connections on all ports within the range.
To implement the aforementioned feature, VSS_resolver_range() as been added to libvarnish.
The Warning: mlock() of VSM failed message is now emitted when locking of shared memory segments (via mlock(2)) fails. As Varnish performance may be severely impacted if shared memory segments are not resident in RAM, users seeing this message are urged to review the RLIMIT_MEMLOCK resource control as set via ulimit -l or LimitMEMLOCK with systemd(1).
A bug has been fixed where string comparisons in VCL could fail with the nonsensical error message Comparison of different types: STRING '==' STRING.
Internal management of probes has been reworked to address race conditions which could cause panics with VCL temperature changes and discards (4108).
Backend tasks can now be instructed to queue if the backend has reached its max_connections. This allows tasks to wait for a connection to become available rather than immediately fail. This feature must be enabled through new global parameters or individual backend attributes:
These parameters can also be set for individual backends using the wait_timeout and wait_limit attributes.
Tasks waiting on a backend going sick (either explicitly via the backend.set_health command or implicitly through the probe) fail immediately.
Global VSC counters have been added under MAIN:
The size of the buffer to hold panic messages is now tunable through the new panic_buffer parameter.
The Varnish Shared Memory (VSM) and Varnish Shared Counters (VSC) consumer implementation in libvarnishapi have been improved for stability and performance.
Add h2_window_timeout parameter to mitigate CVE-2023-43622 (VSV00014).
The parameters idle_send_timeout and timeout_idle are now limited to a maximum of 1 hour.
The VCL variables bereq.connect_timeout, bereq.first_byte_timeout, bereq.between_bytes_timeout, bereq.task_deadline, sess.timeout_idle, sess.timeout_linger, sess.idle_send_timeout and sess.send_timeout can now be unset to use their default values from parameters.
Timeout and deadline parameters can now be set to a new special value never to apply an infinitely long timeout. Parameters which used to be of type timeout but do not accept never have been moved to the new type duration. VCL variables cannot be set to never.
The implementation of the feature flag esi_include_onerror changed in Varnish-Cache 7.3.0 has been reverted to more closely match the behavior before that release: By default, fragments are included again, even errors. When esi_include_onerror is enabled and errors are encountered while processing an ESI fragment, processing only continues if the onerror attribute of the <esi:include> tag is present.
Any response status other than 200 or 204 counts as an error as well as any fetch error.
Streaming responses may continue to be partially delivered.
Error behavior has been fixed to be consistent also for zero length fragments.
The new VSC n_superseded gets incremented every time an object is superseded by a new one, for example when the grace and/or keep timers kept it in cache for longer than the TTL and a fresh copy is fetched.
Cache evictions of superseded objects are logged as ExpKill messages starting with VBF_Superseded.
The implementation of PRIV_TASK and PRIV_TOP VMOD function/method arguments has been fixed to also work with std.rollback() (Varnish-Modules #222)
Transports are now responsible for calling VDP_Close() in all cases.
The format of BackendClose VSL records has been changed to use the short reason name for consistency with SessClose.
During varnishd shutdown, pooled backend connections are now closed bi-directionally.
Mode bits of files opened via the UNIX jail as JAIL_FIXFD_FILE are now correctly set as 0600.
The busy_stats_rate feature now also works for HTTP/2.
The BUILD_VMOD_$NAME m4 macro for VMOD Makefiles has been fixed to properly support custom CFLAGS.
Storage engines are now responsible for deciding which fetch_chunksize to use. When Varnish-Cache does not know the expected object size, it calls the objgetspace stevedore function with a zero sz argument.
The Timestamp SLT with Process prefix is not emitted any more when processing continues as for restarts, or when vcl_deliver transitions to vcl_synth.
The FetchError SLT with HTC prefix now contains a verbose explanation.
Varnish Test Cases (VTCs) now support an include statement.
varnishncsa now supports the %{Varnish:default_format}x format to use the default format with additions.
A deadlock in VRT_AddDirector() is now avoided with dynamic backends when the VCL goes cold.
A new variable bereq.task_deadline, available in sub vcl_pipe {} only for now, allows to limit the total duration of pipe transactions. Its default comes from the pipe_task_deadline parameter, which itself defaults to never.
The VSC counters n_expired, n_purges and n_obj_purged have been fixed for purged objects.
The ExpKill SLT prefix EXP_expire has been renamed to EXP_Inspect.
New VSL records of the ExpKill SLT with EXP_Removed are now emitted to uniformly log all "object removed from cache" events.
VSL records of the ExpKill SLT with EXP_Expired prefix now contain the number of hits on the removed object.
A bug has been fixed in varnishstat where the description of the last VSC was not shown.
VCL COLD events have been fixed for directors vs. VMODs: VDI COLD now comes before VMOD COLD.
The file storage engine now fails properly if the file size is too small.
The .happy stevedore type method now returns true if not implemented instead of panicking varnishd (4036)
Use of objiterate_f on request bodies has been fixed to correctly post OBJ_ITER_END.
Use of STV_NewObject() has been fixed to correctly request zero bytes for attributes where only a body is to be stored.
(struct req).filter_list has been renamed to vdp_filter_list.
304 object copying has been optimized to make optimal use of storage engines' allocations.
Use of the trimstore storage engine function has been fixed for 304 responses.
A missing :scheme for HTTP/2 requests is now properly handled.
The fold flag has been added to Access Control Lists (ACLs) in VCL. When it is activated with acl ... +fold {}, ACL entries get optimized in that subnets contained in other entries are skipped (e.g. if 1.2.3.0/24 is part of the ACL, an entry for 1.2.3.128/25 will not be added) and adjacent entries get folded (e.g. if both 1.2.3.0/25 and 1.2.3.128/25 are added, they will be folded to 1.2.3.0/24) (3563).
Logging under the VCL_acl tag can change with this flag.
Negated ACL entries are never folded.
Fixed handling of failing sub-requests: A VCL failure on the client side or the vcl_req_reset feature could trigger a panic, because it is not allowed to generate a minimal response. For sub-requests, we now masquerade the fail transition as a deliver and trade the illegal minimal response for the synthetic response (4022).
The param.reset [-j] CLI command has been added to reset flags to their default. Consequently, the param.set ... default special value is now deprecated.
The param.set CLI command now supports the none and all values to achieve setting "absolute" values atomically as in param.set foo none,+bar,+baz or param.set foo all,-bar,-baz.
A glitch in CLI command parsing has been fixed where individually quoted arguments like "help" were rejected.
The vcl_req_reset feature (controllable through the feature parameter, see varnishd(1)) has been added and enabled by default to terminate client side VCL processing early when the client is gone.
req_reset events trigger a VCL failure and are reported to vsl(7) as Timestamp: Reset and accounted to main.req_reset in vsc as visible through varnishstat(1).
In particular, this feature is used to reduce resource consumption of HTTP/2 "rapid reset" attacks (see below).
Note that req_reset events may lead to client tasks for which no VCL is called ever. Presumably, this is thus the first time that valid vcl(7) client transactions may not contain any VCL_call records.
Added mitigation options and visibility for HTTP/2 "rapid reset" attacks (CVE-2023-44487, 3996, 3997, 3998, 3999).
Global rate limit controls have been added as parameters, which can be overridden per HTTP/2 session from VCL using the new vmod h2:
The h2_rapid_reset parameter and h2.rapid_reset() function define a threshold duration for an RST_STREAM to be classified as "rapid": If an RST_STREAM frame is parsed sooner than this duration after a HEADERS frame, it is accounted against the rate limit described below.
The default is one second.
The h2_rapid_reset_limit parameter and h2.rapid_reset_limit() function define how many "rapid" resets may be received during the time span defined by the h2_rapid_reset_period parameter / h2.rapid_reset_period() function before the HTTP/2 connection is forcibly closed with a GOAWAY and all ongoing VCL client tasks of the connection are aborted.
The defaults are 100 and 60 seconds, corresponding to an allowance of 100 "rapid" resets per minute.
The h2.rapid_reset_budget() function can be used to query the number of currently allowed "rapid" resets.
Sessions closed due to rapid reset rate limiting are reported as SessClose RAPID_RESET in vsl(7) and accounted to main.sc_rapid_reset in vsc as visible through varnishstat(1).
The cli_limit parameter default has been increased from 48KB to 64KB.
VSUB_closefrom() now falls back to the base implementation not only if close_range() was determined to be unusable at compile time, but also at run time. That is to say, even if close_range() is compiled in, the fallback to the naive implementation remains.
Fixed varnishd -I error reporting when a final newline or carriage return is missing in the CLI command file (3995).
Improved and updated the build system with respect to autoconf and automake.
Improved VSB_tofile() error reporting, added support for partial writes and support of VSBs larger than INT_MAX.
Improved HPACK header validation.
Fixed scopes of protected headers (3984).
The VSB_quote_pfx() (and, consequently, VSB_quote()) function no longer produces \v for a vertical tab. This improves compatibility with JSON.
The bundled zlib has been updated to match zlib 1.3.
The VSHA256_* functions have been added to libvarnishapi (3946).
Tabulation of the vcl.list CLI output has been modified slightly.
VCL now supports "protected headers", which can neither be set nor unset.
The Content-Length and Transfer-Encoding headers are now protected. For the common use case of unset xxx.http.Content-Length to dismiss a body, unset xxx.body should be used.
Error handling of numeric literals in exponent notation has been improved in the VCL compiler (3971).
Finalization of the storage private state of busy objects has been fixed. This bug could trigger a panic when vcl_synth {} was used to replace the object body and storage was changed from one of the built-in storage engines to a storage engine from an extension (3953).
HTTP/2 header field validation is now more strict with respect to allowed characters (3952).
A bug has been fixed in the filter handling code which could trigger a panic when resp.filters was used from vcl_synth {} (3968).
The utility macros ALLOC_OBJ_EXTRA() and ALLOC_FLEX_OBJ() have been added to miniobj.h to simplify allocation of objects larger than a struct and such with a flexible array.
The varnishapi version has been increased to 3.1 and the functions VENC_Encode_Base64() and VENC_Decode_Base64() are now exposed.
Two bugs in the ban expression parser have been fixed where one of them could lead to a panic if a ban expression with an empty header name was issued (3962).
The v_cold macro has been added to add __attribute__((cold)) on compilers supporting it. It is used for VRT_fail() to mark failure code paths as cold.
varnishtest now generates User-Agent request and Server response headers with the respective client and server name by default. The txreq -nouseragent and txresp -noserver options disable addition of these headers.
Error handling of invalid header names has been improved in the VCL Compiler (3960).
A race condition has been fixed in the backend probe code which could trigger a panic with dynamic backends (dyn100).
A bug has been fixed in the ESI code which would prevent use of internal status codes >1000 as their modulus 1000 value (3958).
The varnishd_args_prepend and varnishd_args_append macros have been added to varnishtest to add arguments to varnishd invocations before and after the defaults.
A bug has been fixed where varnishd would hang indefinitely when the worker process would not come up within cli_timeout (3940).
The startup_timeout parameter now specifically replaces cli_timeout for the initial startup only (3940).
On Linux, close_range() is now used if available (3905).
Error reporting has been improved if the working directory (varnishd -n argument) resides on a file system mounted noexec (3943).
The number of backtrace levels in panic reports has been increased from 10 to 20.
The PTOK() macro has been added to vas.h to simplify error checking of pthread_* POSIX functions.
In varnishtest, the basename of the test directory is now available as the vtcid macro to serve as a unique string across concurrently running tests.
In struct vsmwseg and struct vsm_fantom, the class member has been renamed to category.
ESI onerror=abort handling has been fixed when max_esi_depth is reached (3938).
A spurious Could not delete 'vcl_...' error message has been removed (3925).
A bug has been fixed where unset bereq.body had no effect when used with a cached body (3914)
.vcc files of VMODs are now installed to /usr/share/varnish/vcc (or equivalent) to enable re-use by other tools like code editors.
The vcl-step(7) manual page has been added to document the VCL state machines.
HSH_Cancel() has been moved to VDP_Close() to enable transports to keep references to objects.
VCL tracing now needs to be explicitly activated by setting the req.trace or bereq.trace VCL variables, which are initialized from the feature +trace flag. Only if the trace variables are set will VCL_trace log records be generated.
Consequently, VCL_trace has been removed from the default vsl_mask, so any trace records will be emitted by default. vsl_mask can still be used to filter VCL_trace records.
To trace vcl_init {} and vcl_fini {}, set the feature +trace flag while the vcl is loaded/discarded.
Varnish Delivery Processors (VDPs) are now also properly closed for error conditions, avoiding potential minor memory leaks.
A regression introduced with Varnish Cache 7.3.0 was fixed: On HTTP/2 connections, URLs starting with // no longer trigger a protocol error (3911).
Call sites of VMOD functions and methods can now be restricted to built-in subroutines using the $Restrict stanza in the VCC file.
The counter MAIN.http1_iovs_flush has been added to track the number of premature writev() calls due to an insufficient number of IO vectors. This number is configured through the http1_iovs parameter for client connections and implicitly defined by the amount of free workspace for backend connections.
Object creation failures by the selected storage engine are now logged under the Error tag as Failed to create object from %s %s.
The limit on the size of varnishtest macros has been raised to 2KB.
The newly introduced abstract socket support was incompatible with other implementations, this has been fixed (3908).
The macro WS_TASK_ALLOC_OBJ as been added to handle the common case of allocating mini objects on a workspace.
xid variables in VCL are now of type INT.
The new beresp.transit_buffer variable has been added to VCL, which defaults to the newly added parameter transit_buffer. This variable limits the number of bytes varnish pre-fetches for uncacheable streaming fetches.
Varnish now supports abstract unix domain sockets. If the operating system supports them, abstract sockets can be specified using the commonplace @ notation for accept sockets, e.g.:
varnishd -a @kandinsky
and backend paths, e.g.:
backend miro { .path = "@miro"; }
For backend requests, the timestamp from the Last-Modified response header is now only used to create an If-Modified-Since conditional GET request if it is at least one second older than the timestamp from the Date header.
Various interfaces of varnish's own socket address abstraction, VSA, have been changed to return or take pointers to const. VSA_free() has been added.
Processing of Range requests has been improved: Previously, varnish would send a 200 response with the full body when it could not reliably determine (yet) the object size during streaming.
The debug.xid CLI command now sets the next XID to be used, rather than "one less than the next XID to be used"
VXIDs are 64 bit now and the binary format of SHM and raw saved VSL files has changed as a consequence.
The actual valid range for VXIDs is [1…999999999999999], so it fits in a VRT_INTEGER.
At one million cache-missing single request sessions per second VXIDs will roll over in a little over ten years:
(1e15-1) / (3 * 1e6 * 86400 * 365) = 10.57
That should be enough for everybodyâ„¢.
You can test if your downstream log-chewing pipeline handle the larger VXIDs correctly using the CLI command:
``debug.xid 20000000000``
Consequently, VSL clients (log processing tools) are now incompatible with logs and in-memory data written by previous versions, and vice versa.
Do not ESI:include failed objects unless instructed to.
Previously, any ESI:include object would be included, no matter what the status of it were, 200, 503, didn't matter.
From now on, by default, only objects with 200 and 204 status will be included and any other status code will fail the parent ESI request.
If objects with other status should be delivered, they should have their status changed to 200 in VCL, for instance in sub vcl_backend_error{}, vcl_synth{} or vcl_deliver{}.
If param.set feature +esi_include_onerror is used, and the <esi:include …> tag has a onerror="continue" attribute, any and all ESI:include objects will be delivered, no matter what their status might be, and not even a partial delivery of them will fail the parent ESI request. To be used with great caution.
Backend implementations are in charge of logging their headers.
VCL backend probes gained an .expect_close boolean attribute. By setting to to false, backends which fail to honor Connection: close can be probed.
Notice that the probe .timeout needs to be reached for a probe with .expect_close = false to return.
Support for backend connections through a proxy with a PROXY2 preamble has been added:
Unused log tags (SLTs) have been removed.
Directors which take and hold references to other directors via VRT_Assign_Backend() (typically any director which has other directors as backends) are now expected to implement the new .release callback of type void vdi_release_f(VCL_BACKEND). This function is called by VRT_DelDirector(). The implementation is expected drop any backend references which the director holds (again using VRT_Assign_Backend() with NULL as the second argument).
Failure to implement this callback can result in deadlocks, in particular during VCL discard.
Handling of the HTTP/2 :path pseudo header has been improved.
Functions VRT_AddVDP(), VRT_AddVFP(), VRT_RemoveVDP() and VRT_RemoveVFP() are deprecated.
Cookie headers generated by vmod_cookie no longer have a spurious trailing semi-colon (';') at the end of the string. This could break VCL relying on the previous incorrect behavior.
The SessClose and BackendClose reason rx_body, which previously output Failure receiving req.body, has been rewritten to Failure receiving body.
Prototypical Varnish Extensions (VEXT). Similar to VMODs, a VEXT is loaded by the cache process. Unlike VMODs that have the combined lifetime of all the VCLs that reference them, a VEXT has the lifetime of the cache process itself. There are no built-in extensions so far.
The VCC (compilation) process no longer loads VMODs with dlopen(3) to collect their metadata.
Stevedore initialization via the .init() callback has been moved to the worker process.
The parameter tcp_keepalive_time is supported on macOS.
Duration parameters can optionally take a unit, with the same syntax as duration units in VCL. Example: param.set default_grace 1h.
Calls to VRT_CacheReqBody() and std.cache_req_body from outside client vcl subs now fail properly instead of triggering an assertion failure (3846).
New "B" string for the package branch in VCS_String(). For the 7.2.0 version, it would yield the 7.2 branch.
The Varnish version and branch are available in varnishtest through the ${pkg_version} and ${pkg_branch} macros.
New ${topsrc} macro in varnishtest -i mode.
New process pNAME -match-text command in varnishtest to expect text matching a regular expression on screen.
New filewrite [-a] command in varnishtest to put or append a string into a file.
The new vcc_feature bits parameter replaces previous vcc_* boolean parameters. The latter still exist as deprecated aliases.
The -k option from varnishlog is now supported by varnishncsa.
New functions std.now() and std.timed_call() in vmod_std.
New MAIN.shm_bytes counter.
A req.http.via header is set before entering vcl_recv. Via headers are generated using the server.identity value. It defaults to the host name and can be turned into a pseudonym with the varnishd -i option. Via headers are appended in both directions, to work with other hops that may advertise themselves.
A resp.http.via header is no longer overwritten by varnish, but rather appended to.
The server.identity syntax is now limited to a "token" as defined in the HTTP grammar to be suitable for Via headers.
In varnishtest a Varnish instance will use its VTC instance name as its instance name (varnishd -i) by default for predictable Via headers in test cases.
VMOD and VEXT authors can use functions from vnum.h.
Do not filter pseudo-headers as regular headers (VSV00009 / 3830).
The termination rules for WRK_BgThread() were relaxed to allow VMODs to use it.
(struct worker).handling has been moved to the newly introduced struct wrk_vpi and replaced by a pointer to it, as well as (struct vrt_ctx).handling has been replaced by that pointer.
struct wrk_vpi is for state at the interface between VRT and VGC and, in particular, is not const as struct vrt_ctx aka VRT_CTX.
Panics now contain information about VCL source files and lines.
The Begin log record has a 4th field for subtasks like ESI sub-requests.
The -E option for log utilities now works as documented, with any type of sub-task based on the Begin[4] field. This covers ESI like before, and sub-tasks spawned by VMODs (provided that they log the new field).
No more req.http.transfer-encoding for ESI sub-requests.
New tools/coccinelle/vcocci.sh refactoring script for internal use.
The thread pool reserve is now limited to tasks that can be queued. A backend background fetch is no longer eligible for queueing. It would otherwise slow a grace hit down significantly when thread pools are saturated.
The unused fetch_no_thread counter was renamed to bgfetch_no_thread because regular backend fetch tasks are always scheduled.
The macros FEATURE(), EXPERIMENT(), DO_DEBUG(), MGT_FEATURE(), MGT_EXPERIMENT(), MGT_DO_DEBUG() and MGT_VCC_FEATURE() now return a boolean value (0 or 1) instead of the (private) flag value.
There is a new contrib/ directory in the Varnish source tree. The first contribution is a varnishstatdiff script.
A regression in the transport code led MAIN.client_req to be incremented for requests coming back from the waiting list, it was fixed. (3841)
The cookie.format_rfc1123() function was renamed to cookie.format_date(), and the former was retained as a deprecated alias.
The VCC file $Alias stanza has been added to support vmod alias functions/methods.
VCC now supports alias symbols.
There is a new experimental parameter that is identical to the feature parameter, except that it guards features that may not be considered complete or stable. An experimental feature may be promoted to a regular feature or dropped without being considered a breaking change.
ESI includes now support the onerror="continue" attribute of <esi:include/> tags.
The +esi_include_onerror feature flag controls if the attribute is honored: If enabled, failure of an include stops ESI processing unless the onerror="continue" attribute was set for it.
The feature flag is off by default, preserving the existing behavior to continue ESI processing despite include failures.
The deprecated sub-argument of the -l option was removed, it is now a shorthand for the vsl_space parameter only.
The -T, -M and -P command line options can be used multiple times, instead of retaining only the last occurrence.
The debug.xid CLI command has been extended to also set and query the VXID cache chunk size.
The vtc.barrier_sync() VMOD function now also works in vcl_init
The abort command in the logexpect facility of varnishtest can now be used to trigger an abort() to help debugging the vsl client library code.
The vtc.vsl() and vtc.vsl_replay() functions have been added to the vtc vmod to generate arbitrary log lines for testing.
The limit of the vsl_reclen parameter has been corrected.
Varnish now closes client connections correctly when request body processing failed.
Filter init methods of types vdp_init_f and vfp_init_f gained a VRT_CTX argument.
The param.set CLI command accepts a -j option. In this case the JSON output is the same as param.show -j of the updated parameter.
A new cc_warnings parameter contains a subset of the compiler flags extracted from cc_command, which in turn grew new expansions:
For return(pipe), the backend transactions now emit a Start timestamp and both client and backend transactions emit the Process timestamp.
http_IsHdr() is now exposed as part of the strict ABI for VMODs.
The req.transport VCL variable has been added, which returns "HTTP/1" or "HTTP/2" as appropriate.
The vtc.workspace_reserve() VMOD function now zeroes memory.
Parameter aliases have been added to facilitate parameter deprecation.
Two bugs in the catflap facility have been fixed which could trigger panics due to the state pointer not being cleared. (3752, 3755)
It is now possible to assign to a BODY variable either a STRING type or a BLOB.
When the vcl.show CLI command is invoked without a parameter, it now defaults to the active VCL.
The reporting of logexpect events in varnishtest was rearranged for readability.
Workspace debugging as enabled by the +workspace debug flag is now logged with the corresponding transaction.
VMODs should now register and unregister fetch and delivery filters with VRT_AddFilter() and VRT_RemoveFilter().
HSH_purge() has been rewritten to properly handle concurrent purges on the same object head.
VSL_WriteOpen(), varnishlog and varnishncsa have been changed to support writing to stdout with -w - when not in daemon mode.
In VSL, the case has been optimized that the space remaining in a buffer is close to vsl_reclen.
std.ip() has been changed to always return a valid (bogo ip) fallback if the fallback argument is invalid.
New VCL variables {req,req_top,resp,bereq,beresp,obj}.time have been added to track when the respective object was born.
VRT_StaticDirector() has been added to mark directors with VCL lifetime, to avoid the overhead of reference counting.
Dynamic backends are now reference-counted, and VMOD authors must explicitly track assignments with VRT_Assign_Backend().
Varnish will use libunwind by default when available at configure time, the --without-unwind configure flag can prevent this and fall back to libexecinfo to generate backtraces.
A new debug.shutdown.delay command is available in the Varnish CLI for testing purposes.
New utility macros vmin[_t], vmax[_t] and vlimit[_t] available in vdef.h.
The macros TOSTRAND(s) and TOSTRANDS(x, ...) have been added to create a struct strands * (intended to be used as a VCL_STANDS) from a single string s or x strings, respectively.
Note that the macros create a compound literal whose scope is the enclosing block. Their value must thus only be used within the same block (it can be passed to called functions) and must not be returned or referenced for use outside the enclosing block.
As before, VRT_AllocStrandsWS() or VRT_StrandsWS() must be used to create VCL_STRANDS with task scope for use outside the current block.
A bug in the backend connection handling code has been fixed which could trigger an unwarranted assertion failure (3664).
std.strftime() has been added.
Lck_CondWait() has lost the timeout argument and now waits forever. Lck_CondWaitUntil() and Lck_CondWaitTimeout() have been added to wait on a condition variable until some point in time or until a timeout expires, respectively.
All mutex locks in core code have been given the PTHREAD_MUTEX_ERRORCHECK attribute.
Host and Content-Length header checks have been moved to protocol independent code and thus implicitly extended to HTTP2.
A potential race on busy objects has been closed.
Use of the ObjGetSpace() for synthetic objects has been fixed to support stevedores returning less space than requested (as permitted by the API).
The FINI_OBJ() macro has been added to standardize the common pattern of zeroing a mini object and clearing a pointer to it.
The deprecated vsm_space parameter was removed.
The varnishtest err_shell commando has been removed after having been deprecated since release 5.1.0.
An assertion failure has been fixed which triggered when matching bans on non-existing headers (3706).
A VCL compilation issue has been fixed when calling builtin functions directly (3719).
It is now again possible to concatenate static strings to produce combined strings of type VCL_REGEX (3721).
An issue has been fixed that would cause the VCL dependency checker to incorrectly flag VCLs as dependents of other VCLs when using labels, preventing them from being discarded (3734).
VCLs loaded through CLI or the use of startup CLI scripts (-I option to varnishd) will, when no active VCL has previously been set, no longer automatically set the first VCL loaded to the active VCL. This prevents situations where it was possible to make a cold VCL the active VCL (3737).
There is now a configure build-time requirement on working SO_RCVTIMEO and SO_SNDTIMEO socket options.
We no longer check whether they effectively work, so the SO_RCVTIMEO_WORKS feature check has been removed from varnishtest.
The socket option inheritance checks now correctly identifies situations where UDS and TCP listening sockets behave differently, and are no longer subject to the order the inheritance checks happens to be executed (3732).
IPv6 listen endpoint address strings are now printed using brackets.
Body bytes accounting has been fixed to always represent the number of bodybytes moved on the wire, exclusive of protocol-specific overhead like HTTP/1 chunked encoding or HTTP/2 framing.
This change affects counters like
as well as the VSL records
VdpAcct log records have been added to output delivery filter (VDP) accounting details analogous to the existing VfpAcct. Both tags are masked by default.
Many filter (VDP/VFP) related signatures have been changed:
as well as struct vdp_entry and struct vdp_ctx
VFP_Push() and VDP_Push() are no longer intended for VMOD use and have been removed from the API.
The VDP code is now more strict about VDP_END, which must be sent down the filter chain at most once.
Core code has been changed to ensure for most cases that VDP_END gets signaled with the object's last bytes, rather than with an extra zero-data call.
Reason phrases for more HTTP Status codes have been added to core code.
Connection pooling behavior has been improved with respect to Connection: close (3400, 3405).
Handling of the Keep-Alive HTTP header as hop-by-hop has been fixed (3417).
Handling of hop-by-hop headers has been fixed for HTTP/2 (3416).
The stevedore API has been changed:
The verrno.h header file has been removed and merged into vas.h
The connection close reason has been fixed to properly report SC_RESP_CLOSE / resp_close where previously only SC_REQ_CLOSE / req_close was reported.
Unless the new validate_headers feature is disabled, all newly set headers are now validated to contain only characters allowed by RFC7230. A (runtime) VCL failure is triggered if not (3407).
VRT_ValidHdr() has been added for vmods to conduct the same check as the validate_headers feature, for example when headers are set by vmods using the cache_http.c Functions like http_ForceHeader() from untrusted input.
The shard director now supports reconfiguration (adding/removing backends) of several instances without any special ordering requirement.
Calling the shard director .reconfigure() method is now optional. If not called explicitly, any shard director backend changes are applied at the end of the current task.
Shard director Error log messages with (notice) have been turned into Notice log messages.
All shard Error and Notice messages now use the unified prefix vmod_directors: shard %s.
In the shard director, use of parameter sets with resolve=NOW has been fixed.
Performance of log-processing tools like varnishlog has been improved by using mmap() if possible when reading from log files.
An assertion failure has been fixed which could be triggered when a request body was used with restarts (3433, 3434).
A signal handling bug in the Varnish Utility API (VUT) has been fixed which caused log-processing utilities to perform poorly after a signal had been received (3436).
The client.identity variable is now accessible on the backend side.
Client and backend finite state machine internals (enum req_step and enum fetch_step) have been removed from cache.h.
Three new Timestamp VSL records have been added to backend request processing:
The VRT backend interface has been changed:
struct vrt_endpoint has been added describing a UDS or TCP endpoint for a backend to connect to.
Endpoints also support a preamble to be sent with every new connection.
This structure needs to be passed via the endpoint member of struct vrt_backend when creating backends with VRT_new_backend() or VRT_new_backend_clustered().
VRT_Endpoint_Clone() has been added to facilitate working with endpoints.
The variables bereq.is_hitpass and bereq.is_hitmiss have been added to the backend side matching req.is_hitpass and req.is_hitmiss on the client side.
The set_ip_tos() function from the bundled std vmod now sets the IPv6 Traffic Class (TCLASS) when used on an IPv6 connection.
A bug has been fixed which could lead to varnish failing to start after updates due to outdated content of the vmod_cache directory (3243).
An issue has been addressed where using VCL with a high number of literal strings could lead to prolonged c-compiler runtimes since Varnish-Cache 6.3 (3392).
The MAIN.esi_req counter has been added as a statistic of the number of ESI sub requests created.
The vcl.discard CLI command can now be used to discard more than one VCL with a single command, which succeeds only if all given VCLs could be discarded (atomic behavior).
The vcl.discard CLI command now supports glob patterns for vcl names.
The vcl.deps CLI command has been added to output dependencies between VCLs (because of labels and return(vcl) statements).
The FetchError log message Timed out reusing backend connection has been renamed to first byte timeout (reused connection) to clarify that it is emit for effectively the same reason as first byte timeout.
Long strings in VCL can now also be denoted using """ ... """ in addition to the existing {" ... "}.
The pdiff() function declaration has been moved from cache.h to vas.h.
The interface for private pointers in VMODs has been changed:
The MAIN.s_bgfetch counter has been added as a statistic on the number of background fetches issues.
Various improvements have been made to the varnishtest facility:
The ban_cutoff parameter now refers to the overall length of the ban list, including completed bans, where before only non-completed ("active") bans were counted towards ban_cutoff.
A race in the round-robin director has been fixed which could lead to backend requests failing when backends in the director were sick (3473).
A race in the probe management has been fixed which could lead to a panic when VCLs changed temperature in general and when vcl.discard was used in particular (3362).
A bug has been fixed which lead to counters (VSCs) of backends from cold VCLs being presented (3358).
A bug in varnishncsa has been fixed which could lead to it crashing when header fields were referenced which did not exist in the processed logs (3485).
For failing PROXY connections, SessClose now provides more detailed information on the cause of the failure.
The std.ban() and std.ban_error() functions have been added to the std vmod, allowing VCL to check for ban errors.
Use of the ban() built-in VCL command is now deprecated.
The source tree has been reorganized with all vmods now moved to a single vmod directory.
vmodtool.py has been improved to simplify Makefiles when many VMODs are built in a single directory.
The VSA_getsockname() and VSA_getpeername() functions have been added to get address information of file descriptors.
varnishd now supports the -b none argument to start with only the builtin VCL and no backend at all (3067).
Some corner cases of IPv6 support in varnishd have been fixed.
vcl_pipe {}: return(synth) and vmod private state support have been fixed. Trying to use std.rollback() from vcl_pipe now results in VCL failure (3329, 3330, 3385).
The bereq.xid variable is now also available in vcl_pipe {}
The VRT_priv_task_get() and VRT_priv_top_get() functions have been added to VRT to allow vmods to retrieve existing PRIV_TASK / PRIV_TOP private pointers without creating any.
varnishstat now avoids display errors of gauges which previously could underflow to negative values, being displayed as extremely high positive values.
The -r option and the r key binding have been added to return to the previous behavior. When raw mode is active in varnishstat interactive (curses) mode, the word RAW is displayed at the right hand side in the lower status line.
The VSC_IsRaw() function has been added to libvarnishapi to query if a gauge is being returned raw or adjusted.
The busy_stats_rate feature flag has been added to ensure statistics updates (as configured using the thread_stats_rate parameter) even in scenarios where worker threads never run out of tasks and may remain forever busy.
ExpKill log (VSL) records are now masked by default. See the vsl_mask parameter.
A bug has been fixed which could lead to panics when ESI was used with ESI-aware VMODs were used because PRIV_TOP vmod private state was created on a wrong workspace (3496).
The VCL_REGEX data type is now supported for VMODs, allowing them to use regular expression literals checked and compiled by the VCL compiler infrastructure.
Consequently, the VRT_re_init() and VRT_re_fini() functions have been removed, because they are not required and their use was probably wrong anyway.
The filter_re, keep_re and get_re functions from the bundled cookie vmod have been changed to take the VCL_REGEX type. This implies that their regular expression arguments now need to be literal, whereas before they could be taken from some other variable or function returning VCL_STRING.
Note that these functions never actually handled _dynamic_ regexen, the string passed with the first call was compiled to a regex, which was then used for the lifetime of the respective VCL.
The %{X}T format has been added to varnishncsa, which generalizes %D and %T, but also support milliseconds (ms) output.
Error handling has been fixed when vmod functions/methods with PRIV_TASK arguments were wrongly called from the backend side (3498).
The varnishncsa -E argument to show ESI requests has been changed to imply -c (client mode).
Error handling and performance of the VSL (shared log) client code in libvarnishapi have been improved (3501).
varnishlog now supports the -u option to write to a file specified with -w unbuffered.
Comparisons of numbers in VSL queries have been improved to match better the behavior which is likely expected by users who have not read the documentation in all detail (3463).
A bug in the ESI code has been fixed which could trigger a panic when no storage space was available (3502).
The resp.proto variable is now read-only as it should have been for long.
VTCP_open() has been fixed to try all possible addresses from the resolver before giving up (3509). This bug could cause confusing error messages (3510).
VRT_synth_blob() and VRT_synth_strands() have been added. The latter should now be used instead of VRT_synth_page().
The VCL_SUB data type is now supported for VMODs to save references to subroutines to be called later using VRT_call(). Calls from a wrong context (e.g. calling a subroutine accessing req from the backend side) and recursive calls fail the VCL.
See VMOD - Varnish Modules in the Reference Manual.
VMOD functions can also return the VCL_SUB data type for calls from VCL as in call vmod.returning_sub();.
VRT_check_call() can be used to check if a VRT_call() would succeed in order to avoid the potential VCL failure in case it would not.
It returns NULL if VRT_call() would make the call or an error string why not.
VRT_handled() has been added, which is now to be used instead of access to the handling member of VRT_CTX.
The session close reason logging/statistics for HTTP/2 connections have been improved (3393)
varnishadm now has the -p option to disable readline support for use in scripts and as a generic CLI connector.
A log (VSL) Notice record is now emitted whenever more than vary_notice variants are encountered in the cache for a specific hash. The new vary_notice parameter defaults to 10.
The modulus operator % has been added to VCL.
return(retry) from vcl_backend_error {} now correctly resets beresp.status and beresp.reason (3525).
Handling of the gunzip filter with ESI has been fixed (3529).
A bug where the threads_limited counter could be increased without reason has been fixed (3531).
All varnish tools using the VUT library utilities for argument processing now support the --optstring argument to return a string suitable for use with getopts from shell scripts.
An issue with high CPU consumption when the maximum number of threads was reached has been fixed (2942, 3531)
HTTP/2 streams are now reset for filter chain (VDP) errors.
The task priority of incoming connections has been fixed.
An issue has been addressed where the watchdog facility could misfire when tasks are queued.
The builtin VCL has been reworked: VCL code has been split into small subroutines, which custom VCL can prepend custom code to.
This allows for better integration of custom VCL and the built-in VCL and better reuse.
[ABI] marks potentially breaking changes to binary compatibility.
[API] marks potentially breaking changes to source compatibility (implies [ABI]).
varnishstat now has a help screen, available via the h key in curses mode
The initial varnishstat verbosity has been changed to ensure any fields specified by the -f argument are visible (2990)
Fixed handling of out-of-workspace conditions after vcl_backend_response and vcl_deliver during filter initialization (3253, 3241)
PRIV_TOP is now thread-safe to support parallel ESI implementations
varnishstat JSON format (-j option) has been changed:
on the top level, a version identifier has been introduced, which will be used to mark future breaking changes to the JSON formatting. It will not be used to mark changes to the counters themselves.
The new version is 1.
All counters have been moved down one level to the counters object.
VSA_BuildFAP() has been added as a convenience function to build a struct suckaddr
Depending on the setting of the new vcc_acl_pedantic parameter, VCC now either emits a warning or fails if network numbers used in ACLs do not have an all-zero host part.
For vcc_acl_pedantic off, the host part is fixed to all-zero and that fact logged with the ACL VSL tag.
Fixed error handling during object creation after vcl_backend_response (3273)
obj.can_esi has been added to identify if the response can be ESI processed (3002)
resp.filters now contains a correct value when the auto-determined filter list is read (3002)
It is now a VCL (runtime) error to write to resp.do_* and beresp.do_* fields which determine the filter list after setting resp.filters and beresp.filters, respectively
Behavior for 304 responses was changed not to update the Content-Encoding response header of the stored object.
[ABI] struct vfp_entry and struct vdp_ctx changed
[API] VSB_QUOTE_GLOB, which was prematurely added to 6.4, has been removed again.
[API] Add VDP_END action for delivery processors, which has to be sent with or after the last buffer.
Respect the administrative health for "real" (VBE) backends (3299)
Fixed handling of illegal (internal) four-digit response codes and with HTTP/2 (3301)
Fixed backend connection pooling of closed connections (3266)
Added the .resolve method for the BACKEND type to resolve (determine the "real" backend) a director.
Improved vmodtool support for out-of-tree builds
Added VJ_unlink() and VJ_rmdir() jail functions
Fixed workdir cleanup (3307)
Added JAIL_MASTER_SYSTEM jail level
The Varnish Jail (least privileges) code for Solaris has been largely rewritten. It now reduces privileges even further and thus should improve the security of Varnish on Solaris even more.
The Varnish Jail for Solaris now accepts an optional worker= argument which allows to extend the effective privilege set of the worker process.
The shard director and shard director parameter objects should now work in vcl_pipe {} like in vcl_backend_* {} subs.
For a failure in vcl_recv {}, the VCL state engine now returns right after return from that subroutine. (3303)
The shard director now supports weights by scaling the number of replicas of each backend on the consistent hashing ring
Fixed a race in the cache expiry code which could lead to a panic (2999)
Added VRE_quote() to facilitate building literal string matches with regular expressions.
The BackendReuse VSL (log) tag has been retired and replaced with BackendClose, which has been changed to contain either close or recycle to signify whether the connection was closed or returned to a pool for later reuse.
BackendOpen VSL entries have been changed to contain reuse or connect in the last column to signify whether the connection was reused from a pool or newly opened.
std.rollback() of backend requests with return(retry) has been fixed (3353)
FetchError logs now differentiate between No backend and "none resolved" as Director %s returned no backend
Added VRT_DirectorResolve() to resolve a director
Improved VCC handling of symbols and, in particular, type methods
Fixed use of the shard director from vcl_pipe {} (3361)
Handle recursive use of vcl include (3360)
VCL: Added native support for BLOBs in structured fields notation (:<base64>:)
Fixed handling of the Connection: header when multiple instances of the named headers existed.
Added support for naming PRIV_ arguments to vmod methods/functions
The varnish binary heap implementation has been renamed to use the VBH_ prefix, complemented with a destructor and added to header files for use with vmods (via include of vbh.h).
A bug in vmod_blob for base64 decoding with a length argument and non-padding decoding has been fixed (3378)
Added VRT_BLOB_string() to vrt.h
VSB support for dynamic vs. static allocations has been changed:
For dynamic allocations use:
VSB_new_auto() + VSB_destroy()
For preexisting buffers use:
VSB_init() + VSB_fini()
VSB_new() + VSB_delete() are now deprecated.
std.blobread() has been added
New MAIN.beresp_uncacheable and MAIN.beresp_shortlived counters have been added.
The I, X and R arguments have been added to the VSC API and varnishstat for inclusion, exclusion and required glob patterns on the statistic field names. (3394)
Overhaul of the workspace API
Handle a workspace overflow in VRY_Validate() (3319)
Fixed the backend probe .timeout handling for "dripping" responses (3402)
New VARNISH_VMODS_GENERATED() macro in varnish.m4.
Prevent pooling of a Connection: close backend response.
When this header is present, be it sent by the backend or added in vcl_backend_response {}, varnish closes the connection after the current request. (3400)
The MAIN.sess_drop counter is gone.
New configure switch: --with-unwind. Alpine linux appears to offer a libexecinfo implementation that crashes when called by Varnish, this offers the alternative of using libunwind instead.
backend none was added for "no backend".
std.rollback(bereq) is now safe to use, fixed bug 3009
Fixed varnishstat, varnishtop, varnishhist and varnishadm handling INT, TERM and HUP signals (bugs 3088 and 3229)
The hash algorithm of the hash director was changed, so backend selection will change once only when upgrading. Users of the hash director are advised to consider using the shard director, which, amongst other advantages, offers more stable backend selection through consistent hashing.
Log records can safely have empty fields or fields containing blanks if they are delimited by "double quotes". This was applied to SessError and Backend_health.
It is now possible for VMOD authors to customize the connection pooling of a dynamic backend. A hash is now computed to determine uniqueness and a backend declaration can contribute arbitrary data to influence the pool.
The option varnishtest -W is gone, the same can be achieved with varnishtest -p debug=+witness. A witness.sh script is available in the source tree to generate a graphviz dot file and detect potential lock cycles from the test logs.
The Process timestamp for vcl_synth {} was wrongly issued before the VCL subroutine, now it gets emitted after VCL returns for consistency with vcl_deliver {}.
Latencies for newly created worker threads to start work on congested systems have been improved.
VRB_Iterate() signature has changed
VRT_fail() now also works from director code
Deliberately closing backend requests through return(abandon), return(fail) or return(error) is no longer accounted as a fetch failure
Fixed a bug which could cause probes not to run
The if-range header is now handled, allowing clients to conditionally request a range based on a date or an ETag.
Introduced struct reqtop to hold information on the ESI top request and PRIV_TOP, fixed regression 3019
Allow numerical expressions in VCL to be negative / negated
Add vi-stype CTRL-f / CTRL-b for page down/up to interactive varnishstat
Fixed wrong handling of an out-of-workspace condition in the proxy vmod and in the workspace allocator, bug 3131
Raised the minimum for the vcl_cooldown parameter to 1s to fix bug 3135
Improved creation of additional threads when none are available
Fixed a race between director creation and the backend.list CLI command - see bug 3094
Added error handling to avoid panics for workspace overflows during session attribute allocation - bug 3145
Overloaded the += operator to also append to headers
Fixed set *.body commands.
Fixed status for truncated CLI responses, bug 3038
New or improved Coccinelle semantic patches that may be useful for VMOD or utilities authors.
Output VCC warnings also for VCLs loaded via the varnishd -f option, see bug 3160
Improved fetch error handling when stale objects are present in cache, see bug 3089
Added a Notice VSL tag (used for varnishlog logging)
Always refer to sub as subroutine in the documentation and error messages to avoid confusion with other terms.
New pid command in the Varnish CLI, to get the master and optionally cache process PIDs, for example from varnishadm.
Fixed a race that could result in a partial response being served in its entirety when it is also compressed with gzip.
Fixed session close reason reporting and accounting, added rx_close_idle counter for separate accounting when timeout_idle is reached. Also, send_timeout is no longer reported as "remote closed".
Fixed handling of request bodies for backend retries
Fix deadlocks when the maximum number of threads has been reached, in particular with http/2, see 2418
Add more vcl control over timeouts with sess.timeout_linger, sess.send_timeout and sess.idle_send_timeout
Fix panics due to missing EINVAL handling on macOS, see 1853
Added VSLs() and VSLbs() functions for logging STRANDS to VSL
Fixed cases where a workspace overflow would not result in a VCL failure, see 3194
Added WS_VSB_new() / WS_VSB_finish() for VSBs on workspaces
Imported vmod_cookie from varnish_modules
The previously deprecated function cookie.filter_except() has been removed during import. It was replaced by cookie.keep()
body_status and req_body_status have been collapsed into one type. In particular, the REQ_BODY_* enums now have been replaced with BS_*.
Fixed an old regression of the Age: header for passes, see bug 3221
Added VRT_AllocStrandsWS() as a utility function to allocate STRANDS on a workspace.
Reduced compile time of vcl_init{} / vcl_fini{} with gcc, added v_dont_optimize attribute macro
Fixed a case where send_timeout would have no effect when streaming from a backend fetch, see bug 3189
NOTE Users upgrading varnish should re-check send_timeout with respect to long pass and streaming fetches and watch out for increased session close rates.
Added VSB_tofile() to libvarnishapi, see 3238
In addition to a significant number of bug fixes, these are the most important changes in 6.3:
WS_Reserve() is now deprecated and any use should trigger a compiler warning. It is to be replaced by
WS_ReserveAll() to reserve all of the remaining workspace
It will always leave the workspace reserved even if 0 bytes are available, so it must always be followed by a call to WS_Release()
WS_ReserveSize() to reserve a fixed amount.
It will only leave the workspace reserved if the reservation request could be fulfilled.
We provide a script to help automate this change in the tools/coccinelle subdirectory of the source tree.
The RST references generated by vmodtool.py have been changed to match better the VCL syntax to avoid overhead where references are used. The new scheme for a vmod called name is:
To illustrate, the old references:
:ref:`vmod_name.function` :ref:`vmod_name.obj` :ref:`vmod_name.obj.method`
now are renamed to:
:ref:`name.function()` :ref:`name.obj()` :ref:`xobj.method()`
tools/vmod_ref_rename.sh is provided to automate this task
Extend JSON support in the CLI (2783)
Improve accuracy of statistics (VSC)
In Error: out of workspace log entries, the workspace name is now reported in lowercase
Adjust code generator python tools to python 3 and prefer python 3 over python 2 where available
Added a thread pool watchdog which will restart the worker process if scheduling tasks onto worker threads appears stuck. The new parameter thread_pool_watchdog configures it. (2418)
Changed ExpKill log tags to emit microsecond-precision timestamps instead of nanoseconds (2792)
Changed the default of the thread_pool_watchdog parameter to 60 seconds to match the cli_timeout default
VSB quoted output has been unified to three-digit octal, VSB_QUOTE_ESCHEX has been added to prefer hex over octal quoting
Retired long deprecated parameters (VIP16). Replacement mapping is: shm_reclen -> vsl_reclen vcl_dir -> vcl_path vmod_dir -> vmod_path
The width of the columns of the backend.list cli command output is now dynamic.
For best forward compatibility, we recommend that scripts parse JSON output as obtained using the -j option.
See release notes for details.
The format of the backend.list -j (JSON) cli command output has changed.
See release notes for details.
The undocumented -v option to the backend.list cli command has been removed
Changed the formatting of the vcl.list command from:
status state/temperature busy name [labelinfo]
to:
status state temperature busy name [<-|->] [info]
Column width is now dynamic.
Field values remain unchanged except for the label information, see varnish-cli(7) for details.
The ban facility has been extended by bans access to obj.ttl, obj.age, obj.grace and obj.keep and additional inequality operators.
Many cache lookup optimizations.
Display the VCL syntax during a panic.
Update to the VCL diagrams to include hit-for-miss.
libvarnish: VRT_VSA_GetPtr renamed to VSA_GetPtr
Included vtree.h in the distribution for vmods and renamed the red/black tree macros from VRB_* to VRBT_* to disambiguate from the acronym for Varnish Request Body.
Changed the internal organisation of dynamic PRIVs (PRIV_TASK, PRIV_TOP from a list to a red/black tree) for performance. (2813)
Vmod developers are advised that anything returned by a vmod function/method is assumed to be immutable. In other words, a vmod must not modify any data which was previously returned.
Tolerate null IP addresses for ACL matches.
Added vstrerror() as a safe wrapper for strerror() to avoid a NULL pointer dereference under rare conditions where the latter could return NULL. (2815)
Varnish-based tools using the VUT interface should now consider using the VUT_Usage() function for consistency
The name of the event_function callback for VCL events in vmods is now prefixed by $Prefix_` if $Prefix is defined in the .vcc file, or vmod_ by default.
So, for example, with $Event foo and no $Prefix, the event function will be called vmod_foo and with $Prefix bar it will be called bar_foo.
In the vmodtool-generated ReStructuredText documentation, anchors have been renamed
respectively. In short, the anchor is now named equal to VCL syntax for constructors and functions and similarly to VCL syntax for methods.
VRT API has been updated to 9.0
HTTP_Copy() was removed, HTTP_Dup() and HTTP_Clone() were added
Previously, VCL_BLOB was implemented as struct vmod_priv, which had the following shortcomings:
The VCL_BLOB type is now implemented as struct vrt_blob, with the blob member replacing the former priv pointer and the free pointer removed.
A type member was added for lightweight type checking similar to the miniobject magic member, but in contrast to it, type should never be asserted upon.
VRT_blob() was updated accordingly.
req->req_bodybytes was removed. Replacement code snippet:
AZ(ObjGetU64(req->wrk, req->body_oc, OA_LEN, &u));
VRT_SetHealth() has been removed and VRT_SetChanged() added. VRT_LookupDirector() (only to be called from CLI contexts) as been added.
See release notes for details
vmodtool has been changed significantly to avoid various name clashes. Rather than using literal prefixes/suffixes, vmod authors should now (and might have to for making existing code continue to compile) use the following macros
VPFX(name) to prepend the vmod prefix (vmod_ by default)
VARGS(name) as the name of a function/method's argument struct, e.g.:
VCL_VOID vmod_test(VRT_CTX, struct VARGS(test) *args) { ...
VENUM(name) to access the enum by the name name
The counters
now break down the detailed reason for session accept failures, the sum of which continues to be counted in sess_fail.
Fixed implementation of the max_restarts limit: It used to be one less than the number of allowed restarts, it now is the number of return(restart) calls per request.
The cli_buffer parameter has been removed
Added back umem storage for Solaris descendants
The new storage backend type (stevedore) default now resolves to either umem (where available) or malloc.
Since varnish 4.1, the thread workspace as configured by workspace_thread was not used as documented, delivery also used the client workspace.
We are now taking delivery IO vectors from the thread workspace, so the parameter documentation is in sync with reality again.
Users who need to minimize memory footprint might consider decreasing workspace_client by workspace_thread.
The new parameter esi_iovs configures the amount of IO vectors used during ESI delivery. It should not be tuned unless advised by a developer.
Support Unix domain sockets for the -a and -b command-line arguments, and for backend declarations. This requires VCL >= 4.1.
return (fetch) is no longer allowed in vcl_hit {}, use return (miss) instead. Note that return (fetch) has been deprecated since 4.0.
Fix behaviour of restarts to how it was originally intended: Restarts now leave all the request properties in place except for req.restarts and req.xid, which need to change by design.
req.storage, req.hash_ignore_busy and req.hash_always_miss are now accessible from all of the client side subs, not just vcl_recv{}
obj.storage is now available in vcl_hit{} and vcl_deliver{}.
Removed beresp.storage_hint for VCL 4.1 (was deprecated since Varnish 5.1)
For VCL 4.0, compatibility is preserved, but the implementation is changed slightly: beresp.storage_hint is now referring to the same internal data structure as beresp.storage.
In particular, it was previously possible to set beresp.storage_hint to an invalid storage name and later retrieve it back. Doing so will now yield the last successfully set stevedore or the undefined (NULL) string.
IP-valued elements of VCL are equivalent to 0.0.0.0:0 when the connection in question was addressed as a UDS. This is implemented with the bogo_ip in vsa.c.
beresp.backend.ip is retired as of VCL 4.1.
workspace overflows in std.log() now trigger a VCL failure.
workspace overflows in std.syslog() are ignored.
added return(restart) from vcl_recv{}.
The alg argument of the shard director .reconfigure() method has been removed - the consistent hashing ring is now always generated using the last 32 bits of a SHA256 hash of "ident%d" as with alg=SHA256 or the default.
We believe that the other algorithms did not yield sufficiently dispersed placement of backends on the consistent hashing ring and thus retire this option without replacement.
Users of .reconfigure(alg=CRC32) or .reconfigure(alg=RS) be advised that when upgrading and removing the alg argument, consistent hashing values for all backends will change once and only once.
The alg argument of the shard director .key() method has been removed - it now always hashes its arguments using SHA256 and returns the last 32 bits for use as a shard key.
Backwards compatibility is provided through vmod blobdigest with the key_blob argument of the shard director .backend() method:
for alg=CRC32, replace:
<dir>.backend(by=KEY, key=<dir>.key(<string>, CRC32))
with:
<dir>.backend(by=BLOB, key_blob=blobdigest.hash(ICRC32, blob.decode(encoded=<string>)))
Note: The vmod blobdigest hash method corresponding to the shard director CRC32 method is called ICRC32
for alg=RS, replace:
<dir>.backend(by=KEY, key=<dir>.key(<string>, RS))with:
<dir>.backend(by=BLOB, key_blob=blobdigest.hash(RS, blob.decode(encoded=<string>)))
The shard director now offers resolution at the time the actual backend connection is made, which is how all other bundled directors work as well: With the resolve=LAZY argument, other shard parameters are saved for later reference and a director object is returned.
This enables layering the shard director below other directors.
The shard director now also supports getting other parameters from a parameter set object: Rather than passing the required parameters with each .backend() call, an object can be associated with a shard director defining the parameters. The association can be changed in vcl_backend_fetch() and individual parameters can be overridden in each .backend() call.
The main use case is to segregate shard parameters from director selection: By associating a parameter object with many directors, the same load balancing decision can easily be applied independent of which set of backends is to be used.
To support parameter overriding, support for positional arguments of the shard director .backend() method had to be removed. In other words, all parameters to the shard director .backend() method now need to be named.
Integers in VCL are now 64 bits wide across all platforms (implemented as int64_t C type), but due to implementation specifics of the VCL compiler (VCC), integer literals' precision is limited to that of a VCL real (double C type, roughly 53 bits).
In effect, larger integers are not represented accurately (they get rounded) and may even have their sign changed or trigger a C compiler warning / error.
Add VMOD unix.
Add VMOD proxy.
This is the first beta release of the upcoming 5.0 release.
The list of changes are numerous and will not be expanded on in detail.
The release notes contain more background information and are highly recommended reading before using any of the new features.
Major items:
Changes since 4.1.8:
Changes since 4.1.7:
Changes since 4.1.7-beta1:
Changes since 4.1.6:
Changes between 4.0 and 4.1 are numerous. Please read the upgrade section in the documentation for a general overview.
New since 4.0.2-rc1:
New since 4.0.1:
New since 4.0.0:
New since 4.0.0-beta1:
New since TP2:
varnishsizes -----------~
Persistent storage is now experimentally supported using the persistent stevedore. It has the same command line arguments as the file stevedore.
obj.* is now called beresp.* in vcl_fetch, and obj.* is now read-only.
The regular expression engine is now PCRE instead of POSIX regular expressions.
req.* is now available in vcl_deliver.
Add saint mode where we can attempt to grace an object if we don't like the backend response for some reason.
Related, add saintmode_threshold which is the threshold for the number of objects to be added to the trouble list before the backend is considered sick.
Add a new hashing method called critbit. This autoscales and should work better on large object workloads than the classic hash. Critbit has been made the default hash algorithm.
When closing connections, we experimented with sending RST to free up load balancers and free up threads more quickly. This caused some problems with NAT routers and so has been reverted for now.
Add thread that checks objects against ban list in order to prevent ban list from growing forever. Note that this needs purges to be written so they don't depend on req.*. Enabled by setting ban_lurker_sleep to a nonzero value.
The shared memory log file format was limited to maximum 64k simultaneous connections. This is now a 32 bit field which removes this limitation.
Remove obj_workspace, this is now sized automatically.
Rename acceptors to waiters
vcl_prefetch has been removed. It was never fully implemented.
Add support for authenticating CLI connections.
Add hash director that chooses which backend to use depending on req.hash.
Add client director that chooses which backend to use depending on the client's IP address. Note that this ignores the X-Forwarded-For header.
varnishd now displays a banner by default when you connect to the CLI.
Increase performance somewhat by moving statistics gathering into a per-worker structure that is regularly flushed to the global stats.
Make sure we store the header and body of object together. This may in some cases improve performance and is needed for persistence.
Remove client-side address accounting. It was never used for anything and presented a performance problem.
Add a timestamp to bans, so you can know how old they are.
Quite a few people got confused over the warning about not being able to lock the shared memory log into RAM, so stop warning about that.
Change the default CLI timeout to 10 seconds.
We previously forced all inserts into the cache to be GET requests. This has been changed to allow POST as well in order to be able to implement purge-on-POST semantics.
The CLI command stats now only lists non-zero values.
The CLI command stats now only lists non-zero values.
Use daemon(3) from libcompat on Darwin.
Remove vcl_discard as it causes too much complexity and never actually worked particularly well.
Remove vcl_timeout as it causes too much complexity and never actually worked particularly well.
Update the documentation so it refers to sess_workspace, not http_workspace.
Document the -i switch to varnishd as well as the server.identity and server.hostname VCL variables.
purge.hash is now deprecated and no longer shown in help listings.
When processing ESI, replace the five mandatory XML entities when we encounter them.
Add string representations of time and relative time.
Add locking for n_vbe_conn to make it stop underflowing.
When ESI-processing content, check for illegal XML character entities.
Varnish can now connect its CLI to a remote instance when starting up, rather than just being connected to.
It is no longer needed to specify the maximum number of HTTP headers to allow from backends. This is now a run-time parameter.
The X-Forwarded-For header is now generated by vcl_recv rather than the C code.
It is now possible to not send all CLI traffic to syslog.
It is now possible to not send all CLI traffic to syslog.
In the case of varnish crashing, it now outputs a identifying string with the OS, OS revision, architecture and storage parameters together with the backtrace.
Use exponential backoff when we run out of file descriptors or sessions.
Allow setting backend timeouts to zero.
Count uptime in the shared memory log.
Try to detect the case of two running varnishes with the same shmlog and storage by writing the master and child process ids to the shmlog and refusing to start if they are still running.
Make sure to use EOF mode when serving ESI content to HTTP/1.0 clients.
Make sure we close the connection if it either sends Connection: close or it is a HTTP/1.0 backend that does not send Connection: keep-alive.
Increase the default session workspace to 64k on 64-bit systems.
Make the epoll waiter use level triggering, not edge triggering as edge triggering caused problems on very busy servers.
Handle unforeseen client disconnections better on Solaris.
Make session lingering apply to new sessions, not just reused sessions.
VCL Manual page --------------~
Red Hat spec file ----------------~
Build system -----------~
Build system -----------~
Build system -----------~
The request workflow has been redesigned to simplify request processing and eliminate code duplication. All codepaths which need to speak HTTP now share a single implementation of the protocol. Some new VCL hooks have been added, though they aren't much use yet. The only real user-visible change should be that Varnish now handles persistent backend connections correctly (see ticket #56).
Support for multiple listen addresses has been added.
An "include" facility has been added to VCL, allowing VCL code to pull in code fragments from multiple files.
Multiple definitions of the same VCL function are now concatenated into one in the order in which they appear in the source. This simplifies the mechanism for falling back to the built-in default for cases which aren't handled in custom code, and facilitates modularization.
The code used to format management command arguments before passing them on to the child process would underestimate the amount of space needed to hold each argument once quotes and special characters were properly escaped, resulting in a buffer overflow. This has been corrected.
The VCL compiler has been overhauled. Several memory leaks have been plugged, and error detection and reporting has been improved throughout. Parts of the compiler have been refactored to simplify future extension of the language.
A bug in the VCL compiler which resulted in incorrect parsing of the decrement (-=) operator has been fixed.
A new -C command-line option has been added which causes varnishd to compile the VCL code (either from a file specified with -f or the built-in default), print the resulting C code and exit.
When processing a backend response using chunked encoding, if a chunk header crosses a read buffer boundary, read additional bytes from the backend connection until the chunk header is complete.
A new ping_interval run-time parameter controls how often the management process checks that the worker process is alive.
A bug which would cause the worker process to dereference a NULL pointer and crash if the backend did not respond has been fixed.
In some cases, such as when they are used by AJAX applications to circumvent Internet Explorer's over-eager disk cache, it may be desirable to cache POST requests. However, the code path responsible for delivering objects from cache would only transmit the response body when replying to a GET request. This has been extended to also apply to POST.
This should be revisited at a later date to allow VCL code to control whether the body is delivered.
Varnish now respects Cache-control: s-maxage, and prefers it to Cache-control: max-age if both are present.
This should be revisited at a later date to allow VCL code to control which headers are used and how they are interpreted.
When loading a new VCL script, the management process will now load the compiled object to verify that it links correctly before instructing the worker process to load it.
A new -P command-line options has been added which causes varnishd to create a PID file.
The sendfile_threshold run-time parameter's default value has been set to infinity after a variety of sendfile()-related bugs were discovered on several platforms.
The formatting callback has been largely rewritten for clarity, robustness and efficiency.
If a request included a Host: header, construct and output an absolute URL. This makes varnishncsa output from servers which handle multiple virtual hosts far more useful.
The flag that is raised upon reception of a SIGHUP has been marked volatile so it will not be optimized away by the compiler.