]> err.no Git - varnish/commitdiff
Add a lot more paranoia asserts
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Feb 2009 18:00:06 +0000 (18:00 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Feb 2009 18:00:06 +0000 (18:00 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3798 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_expire.c
varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/cache_pool.c

index 41f4804d72f52378adf4e56ce15a800a415e9124..35d97366951c62c7a333f028dd7ba367714ec96d 100644 (file)
@@ -251,6 +251,7 @@ exp_timer(void *arg)
 
                o = oc->obj;
                CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+               CHECK_OBJ_NOTNULL(o->objhead, OBJHEAD_MAGIC);
                assert(oc->timer_idx != BINHEAP_NOIDX);
                binheap_delete(exp_heap, oc->timer_idx);
                assert(oc->timer_idx == BINHEAP_NOIDX);
index 70c7bf31f47762f774b1714cc5029aaec24f32fb..961adc7458cb7328b119270551e19a0d3a6998d2 100644 (file)
@@ -356,6 +356,7 @@ HSH_Lookup(struct sess *sp)
                        WSP(sp, SLT_Debug,
                                "on waiting list <%s>", oh->hash);
                sp->objhead = oh;
+               sp->wrk = NULL;
                Lck_Unlock(&oh->mtx);
                return (NULL);
        }
@@ -393,10 +394,14 @@ hsh_rush(struct objhead *oh)
        unsigned u;
        struct sess *sp;
 
+       CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
+       Lck_AssertHeld(&oh->mtx);
        for (u = 0; u < params->rush_exponent; u++) {
                sp = VTAILQ_FIRST(&oh->waitinglist);
                if (sp == NULL)
                        return;
+               CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+               AZ(sp->wrk);
                VTAILQ_REMOVE(&oh->waitinglist, sp, list);
                DSL(0x20, SLT_Debug, sp->id, "off waiting list");
                WRK_QueueSession(sp);
index e555ef071b605ac5c9b65a81a285679097bbe64c..1db99e18cfad84dffaa123f6c511aa56a5d77155 100644 (file)
@@ -330,10 +330,8 @@ wrk_thread(void *priv)
                                w->lastused = TIM_real();
                        VTAILQ_INSERT_HEAD(&qp->idle, w, list);
                        if (!stats_clean) {
-                               Lck_Lock(&wstat_mtx);
-                               wrk_sumstat(w);
+                               WRK_SumStat(w);
                                stats_clean = 1;
-                               Lck_Unlock(&wstat_mtx);
                        }
                        Lck_CondWait(&w->cond, &qp->mtx);
                }
@@ -348,6 +346,7 @@ wrk_thread(void *priv)
                AZ(w->wfd);
                assert(w->wlp == w->wlb);
                w->wrq = NULL;
+               HSH_Cleanup(w);
                if (!Lck_Trylock(&wstat_mtx)) {
                        wrk_sumstat(w);
                        stats_clean = 1;
@@ -430,6 +429,7 @@ wrk_do_cnt_sess(struct worker *w, void *priv)
        struct sess *sess;
 
        CAST_OBJ_NOTNULL(sess, priv, SESS_MAGIC);
+       AZ(sess->wrk);
        THR_SetSession(sess);
        sess->wrk = w;
        CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
@@ -445,6 +445,8 @@ wrk_do_cnt_sess(struct worker *w, void *priv)
 void
 WRK_QueueSession(struct sess *sp)
 {
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       AZ(sp->wrk);
        sp->workreq.func = wrk_do_cnt_sess;
        sp->workreq.priv = sp;
        if (WRK_Queue(&sp->workreq) == 0)