Disabling close in vcl_error leaks n_sess_mem

Paul Armstrong varnish-cache at otoh.org
Tue Jan 7 20:15:27 CET 2014


Originally posted to varnish-dev, but varnish-misc was suggested as a better
place.

For our use case, we need to disable the default behavior of closing
connections whenever vcl_error is called so that we can generate
synthetic responses to various error conditions without causing connections to
be constantly re-established (our use case is high speed traffic over
connections which are kept alive for minutes at a time). We've applied the
following patch in an effort to do this, but we keep on seeing leaks of
n_sess_mem (it routinely bumps up against the 100,000 limit when we have high
levels of traffic responded to synthetically).

--- varnish-3.0.5/bin/varnishd/cache_center.c.orig  2013-12-02
+08:06:30.000000000 +0000
+++ varnish-3.0.5/bin/varnishd/cache_center.c       2013-12-31
+22:54:57.094893222 +0000
@@ -495,13 +495,18 @@


        /* We always close when we take this path */
-       sp->doclose = "error";
+       // sp->doclose = "error";
        sp->wantbody = 1;

        assert(sp->handling == VCL_RET_DELIVER);
        sp->err_code = 0;
        sp->err_reason = NULL;
        http_Setup(sp->wrk->bereq, NULL);
+       if (sp->obj->objcore != NULL) {
+               AN(sp->obj->objcore);
+               AN(sp->obj->objcore->ban);
+               HSH_Unbusy(sp);
+       }
        sp->step = STP_PREPRESP;
        return (0);
 }

Obviously, we're missing some point in the cleanup process, but we're having
trouble identifying it and some assistance would be appreciated.

Anyone have ideas on what we're missing or where we should start in hunting
this down?

Thanks,
Paul



More information about the varnish-misc mailing list