Mailing List Archive

[6.0] ca5071770 Log using SLT_Notice on condfetch streaming delay
commit ca5071770535bd657c31575c23cad408c859906e
Author: Martin Blix Grydeland <martin@varnish-software.com>
Date: Mon Nov 25 12:01:42 2019 +0100

Log using SLT_Notice on condfetch streaming delay

Log a notice message when delaying a conditional fetch and the stale
template object is still streaming.

Conflicts:
bin/varnishd/cache/cache_fetch.c
doc/sphinx/reference/vsl.rst

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 2395b1b33..f85372b10 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -706,6 +706,34 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)

CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC);
+ CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC);
+
+ stale_boc = HSH_RefBoc(bo->stale_oc);
+ CHECK_OBJ_ORNULL(stale_boc, BOC_MAGIC);
+ if (stale_boc) {
+ /* Wait for the stale object to become fully fetched, so
+ * that we can catch fetch errors, before we unbusy the
+ * new object. This serves two purposes. First it helps
+ * with request coalesching, and stops long chains of
+ * IMS-updated short-TTL objects all streaming from a
+ * single slow body fetch. Second it makes sure that all
+ * the object attributes are complete when we copy them
+ * (this would be an issue for ie OA_GZIPBITS). */
+ VSLb(bo->vsl, SLT_Notice,
+ "[core] Conditional fetch wait for streaming object");
+ ObjWaitState(bo->stale_oc, BOS_FINISHED);
+ stale_state = stale_boc->state;
+ HSH_DerefBoc(bo->wrk, bo->stale_oc);
+ stale_boc = NULL;
+ if (stale_state != BOS_FINISHED) {
+ (void)VFP_Error(bo->vfc, "Template object failed");
+ vbf_cleanup(bo);
+ wrk->stats->fetch_failed++;
+ return (F_STP_FAIL);
+ }
+ }
+ AZ(bo->stale_oc->flags & OC_F_FAILED);

AZ(vbf_beresp2obj(bo));

diff --git a/doc/sphinx/reference/vsl.rst b/doc/sphinx/reference/vsl.rst
index 3f39c67b6..4d01f5ba8 100644
--- a/doc/sphinx/reference/vsl.rst
+++ b/doc/sphinx/reference/vsl.rst
@@ -102,6 +102,26 @@ Error
Backend request failed to vcl_backend_error.


+NOTICE MESSAGES
+===============
+
+Notice messages contain informational messages about the handling of a
+request. These can be exceptional circumstances encountered that causes
+deviation from the normal handling. The messages are prefixed with [core]
+for core Varnish generated messages, or with [<VMOD name>] for VMOD
+generated messages. The [core] messages are described in detail below, see
+the individual VMOD documentation for messages from VMODs.
+
+[core] Conditional fetch wait for streaming object
+ The backend answered 304 Not Modified on a conditional fetch using
+ an object that has not yet been fully fetched as the stale
+ template object. This can only happen when the TTL of the object
+ is less than the time it takes to fetch it. The fetch is halted
+ until the stale object is fully fetched, upon which the new object
+ is created as normal. While waiting, any grace time on the stale
+ object will be in effect.
+
+
HISTORY
=======

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit