[master] c44bd67f2 Fix order of COLD events for directors vs. VCL

Nils Goroll nils.goroll at uplex.de
Mon Jan 15 14:30:07 UTC 2024


commit c44bd67f25216746311b3f65ba39552a8971934b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Jan 5 21:33:25 2024 +0100

    Fix order of COLD events for directors vs. VCL
    
    vcldir_retire() only sends a VCL_EVENT_COLD when the vcl is warm. In
    other words, it (rightly) asserts that a COLD event (if any) has
    alrady been posted when a director is deleted on a COLD vcl.
    
    Yet, when the director is deleted upon a COLD vmod event, this assertion
    was wrong, because the COLD events for directors were only posted after
    vmod events.
    
    Given that vmods do things like deleting directors, it appears (more)
    correct to post VDI COLD events before VMOD COLD events.

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 29d4b459f..90e41ece8 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -594,9 +594,9 @@ vcl_set_state(struct vcl *vcl, const char *state, struct vsb **msg)
 		if (vcl->busy == 0 && vcl->temp->is_warm) {
 			vcl->temp = VTAILQ_EMPTY(&vcl->ref_list) ?
 			    VCL_TEMP_COLD : VCL_TEMP_COOLING;
+			vcl_BackendEvent(vcl, VCL_EVENT_COLD);
 			AZ(vcl_send_event(vcl, VCL_EVENT_COLD, msg));
 			AZ(*msg);
-			vcl_BackendEvent(vcl, VCL_EVENT_COLD);
 		}
 		else if (vcl->busy)
 			vcl->temp = VCL_TEMP_BUSY;
diff --git a/include/vrt.h b/include/vrt.h
index 2a478b372..f5ea03bc5 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -59,6 +59,7 @@
  *
  * NEXT (2024-03-15)
  *	[cache.h] (struct req).filter_list renamed to vdp_filter_list
+ *	order of vcl/vmod and director COLD events reversed to directors first
  * 18.1 (2023-12-05)
  *	vbf_objiterate() implementation changed #4013
  * 18.0 (2023-09-15)


More information about the varnish-commit mailing list