Disabling connection close in vcl_error

Paul Armstrong varnish-cache at otoh.org
Sun Jan 5 19:12:56 CET 2014


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. 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.

Thanks,
Paul



More information about the varnish-dev mailing list