Skip to content

Commit

Permalink
Ensure that transports call VDP_Close()
Browse files Browse the repository at this point in the history
  • Loading branch information
nigoroll committed Mar 1, 2024
1 parent 20aee1b commit bb3d027
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/varnishd/cache/cache_deliver_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ VDP_Panic(struct vsb *vsb, const struct vdp_ctx *vdc)
VSB_cat(vsb, "},\n");
}


/*
* Ensure that transports have called VDP_Close()
* to avoid leaks in VDPs
*/
void
VDP_Fini(struct vdp_ctx *vdc)
{
assert(VTAILQ_EMPTY(&vdc->vdp));
}

void
VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
Expand Down
2 changes: 2 additions & 0 deletions bin/varnishd/cache/cache_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
wrk->stats->ws_client_overflow++;

wrk->seen_methods = 0;

VDP_Fini(req->vdc);
}

/*----------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions bin/varnishd/cache/cache_varnishd.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void VDI_Event(const struct director *d, enum vcl_event_e ev);
void VDI_Init(void);

/* cache_deliver_proc.c */
void VDP_Fini(struct vdp_ctx *vdc);
void VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
struct req *req);
uint64_t VDP_Close(struct vdp_ctx *, struct objcore *, struct boc *);
Expand Down

0 comments on commit bb3d027

Please sign in to comment.