[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [master] 5335cf6a7 stevedore: Log failures to create objects
From:       Dridi Boukelmoune <dridi.boukelmoune () gmail ! com>
Date:       2023-04-18 10:19:06
Message-ID: 20230418101906.31FBA11A649 () lists ! varnish-cache ! org
[Download RAW message or body]


commit 5335cf6a7ca488cc9a8cce7208b3d23b7e21b18f
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date:   Thu Apr 13 11:40:44 2023 +0200

    stevedore: Log failures to create objects
    
    We only log a Storage record when we successfully create an object, but
    there may be no clue regarding which storage backend failed to allocate.
    We can infer from stevedore VSCs where allocation failures happened, but
    knowing from a VCL transaction which one failed will give a definitive
    answer.
    
    This is logged as an Error record, and the existing FetchError record
    from VFPs ("Could not get storage") is left alone.

diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index ccacac33c..002fcf627 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -88,8 +88,12 @@ STV_NewObject(struct worker *wrk, struct objcore *oc,
 
 	wrk->strangelove = cache_param->nuke_limit;
 	AN(stv->allocobj);
-	if (stv->allocobj(wrk, stv, oc, wsl) == 0)
+	if (stv->allocobj(wrk, stv, oc, wsl) == 0) {
+		VSLb(wrk->vsl, SLT_Error,
+		    "Failed to create object object from %s %s",
+		    stv->name, stv->ident);
 		return (0);
+	}
 	oc->oa_present = 0;
 	wrk->stats->n_object++;
 	VSLb(wrk->vsl, SLT_Storage, "%s %s",
diff --git a/bin/varnishtest/tests/r03502.vtc b/bin/varnishtest/tests/r03502.vtc
index 88b56e2ec..db9e0a97f 100644
--- a/bin/varnishtest/tests/r03502.vtc
+++ b/bin/varnishtest/tests/r03502.vtc
@@ -41,6 +41,7 @@ logexpect l1 -v v1 -g vxid -q "vxid == 1004" {
 	# Ensure the FetchError is in vbf_beresp2obj()
 	# not later in the VFP. Otherwise we have too much free_space
 	fail add  =	Storage
+	expect 0  =	Error      	{^Failed to create object object from .+ Transient}
 	expect 0  =	FetchError      {^Could not get storage}
 	fail clear
 } -start
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic