Permalink
Browse files

Show VDPs if present during a panic

And get a chance to catch vdp->fini() failures with the offending VDP
still present in the list of filters.
  • Loading branch information...
Dridi committed Feb 8, 2019
1 parent 009297d commit b588404ab8da52b2b9a2b7e8f77af091cdaba965
Showing with 29 additions and 3 deletions.
  1. +1 −1 bin/varnishd/cache/cache_deliver_proc.c
  2. +28 −2 bin/varnishd/cache/cache_panic.c
@@ -128,10 +128,10 @@ VDP_close(struct req *req)
AN(vdpe);
if (vdpe != NULL) {
CHECK_OBJ(vdpe, VDP_ENTRY_MAGIC);
VTAILQ_REMOVE(&vdc->vdp, vdpe, list);
if (vdpe->vdp->fini != NULL)
AZ(vdpe->vdp->fini(req, &vdpe->priv));
AZ(vdpe->priv);
VTAILQ_REMOVE(&vdc->vdp, vdpe, list);
}
vdc->nxt = VTAILQ_FIRST(&vdc->vdp);
}
@@ -360,6 +360,7 @@ pan_vfp(struct vsb *vsb, const struct vfp_ctx *vfc)

VSB_printf(vsb, "vfc = %p {\n", vfc);
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, vfc, VFP_CTX_MAGIC);
VSB_printf(vsb, "failed = %d,\n", vfc->failed);
VSB_printf(vsb, "req = %p,\n", vfc->req);
VSB_printf(vsb, "resp = %p,\n", vfc->resp);
@@ -370,8 +371,7 @@ pan_vfp(struct vsb *vsb, const struct vfp_ctx *vfc)
VSB_printf(vsb, "filters = {\n");
VSB_indent(vsb, 2);
VTAILQ_FOREACH(vfe, &vfc->vfp, list) {
VSB_printf(vsb, "%s = %p {\n",
vfe->vfp->name, vfe);
VSB_printf(vsb, "%s = %p {\n", vfe->vfp->name, vfe);
VSB_indent(vsb, 2);
VSB_printf(vsb, "priv1 = %p,\n", vfe->priv1);
VSB_printf(vsb, "priv2 = %zd,\n", vfe->priv2);
@@ -388,6 +388,30 @@ pan_vfp(struct vsb *vsb, const struct vfp_ctx *vfc)
VSB_printf(vsb, "},\n");
}

static void
pan_vdp(struct vsb *vsb, const struct vdp_ctx *vdc)
{
struct vdp_entry *vde;

VSB_printf(vsb, "vdc = %p {\n", vdc);
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, vdc, VDP_CTX_MAGIC);
VSB_printf(vsb, "nxt = %p,\n", vdc->nxt);
VSB_printf(vsb, "retval = %d,\n", vdc->retval);

if (!VTAILQ_EMPTY(&vdc->vdp)) {
VSB_printf(vsb, "filters = {\n");
VSB_indent(vsb, 2);
VTAILQ_FOREACH(vde, &vdc->vdp, list)
VSB_printf(vsb, "%s = %p { priv = %p }\n",
vde->vdp->name, vde, vde->priv);
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
}

VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
}

static void
pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
@@ -511,6 +535,8 @@ pan_req(struct vsb *vsb, const struct req *req)
pan_http(vsb, "req", req->http);
if (req->resp->ws != NULL)
pan_http(vsb, "resp", req->resp);
if (req->vdc != NULL)
pan_vdp(vsb, req->vdc);

VCL_Panic(vsb, "vcl", req->vcl);
VCL_Panic(vsb, "vcl0", req->vcl0);

0 comments on commit b588404

Please sign in to comment.