[master] 0ed0f2f In panic code, handle NULL pointers with grace

Nils Goroll nils.goroll at uplex.de
Thu May 24 09:14:09 UTC 2018

commit 0ed0f2fa713348daf73c6eddcde9db2a5956b87f
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu May 24 11:10:12 2018 +0200

    In panic code, handle NULL pointers with grace
    We do not want to cause a panic from the panic handler.
    It could be argued that bo->vfc cannot possibly be NULL, except
    when it is - and that's what we got the panic handler for.
    vfc->failed is output by pan_vfp now so I should have removed
    that duplication when introducing pan_vfp

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index cf22c0e..8282ed8 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -401,9 +401,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 	VSB_indent(vsb, 2);
 	PAN_CheckMagic(vsb, bo, BUSYOBJ_MAGIC);
 	pan_ws(vsb, bo->ws);
-	AN(bo->vfc);
 	VSB_printf(vsb, "retries = %d, ", bo->retries);
-	VSB_printf(vsb, "failed = %d, ", bo->vfc->failed);
 	VSB_printf(vsb, "flags = {");
 	p = "";
 /*lint -save -esym(438,p) -e539 */
@@ -416,7 +414,8 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 	if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC))
 		pan_htc(vsb, bo->htc);
-	pan_vfp(vsb, bo->vfc);
+	if (bo->vfc)
+		pan_vfp(vsb, bo->vfc);
 	VDI_Panic(bo->director_req, vsb, "director_req");
 	if (bo->director_resp == bo->director_req)

More information about the varnish-commit mailing list