<div dir="ltr"><div class="gmail_default" style="color:rgb(0,0,153)">Hi,<br><br></div><div class="gmail_default" style="color:rgb(0,0,153)">I was trying to understand the function<br><br><span style="font-family:monospace,monospace"> <span style="color:rgb(0,0,0)">enum lookup_e<br>HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,<br>    int always_insert)<br><br></span></span></div><div class="gmail_default" style="color:rgb(0,0,153)">located in <span style="font-family:monospace,monospace">bin/varnishd/cache/cache_hash.<wbr>c</span><br><br></div><div class="gmail_default" style="color:rgb(0,0,153)">My understanding is, if the lookedup-object in the cache is expired, the code seems to look if the object is busy or not and accordingly returns <span style="font-family:monospace,monospace">HSH_EXPBUSY</span> or <span style="font-family:monospace,monospace">HSH_BUSY</span>.<br><br></div><div class="gmail_default" style="color:rgb(0,0,153)">lines 474 to 501 in cache_hash.c<br><span style="color:rgb(0,0,0)"><span style="font-family:monospace,monospace">    if (exp_oc != NULL && exp_oc->flags & OC_F_PASS) {<br>        wrk->stats->cache_hitmiss++;<br>        VSLb(req->vsl, SLT_HitMiss, "%u %.6f", ObjGetXID(wrk, exp_oc),<br>            EXP_Dttl(req, exp_oc));<br>        exp_oc = NULL;<br>        busy_found = 0;<br>    }<br><br>    if (exp_oc != NULL) {<br>        assert(oh->refcnt > 1);<br>        assert(exp_oc->objhead == oh);<br>        exp_oc->refcnt++;<br><br>        <span style="color:rgb(255,0,0)">if (!busy_found) {<br>            *bocp = hsh_insert_busyobj(wrk, oh);<br>            retval = HSH_EXPBUSY;<br>        } else {<br>            AZ(req->hash_ignore_busy);<br>            retval = HSH_EXP;<br>        }</span><br>        if (exp_oc->hits < LONG_MAX)<br>            exp_oc->hits++;<br>        Lck_Unlock(&oh->mtx);<br>        if (retval == HSH_EXP)<br>            assert(HSH_DerefObjHead(wrk, &oh));<br>        *ocp = exp_oc;<br>        return (retval);<br>    }<br><br>    if (<span style="color:rgb(255,0,0)">!busy_found</span>) {<br>        /* Insert objcore in objecthead and release mutex */<br>        *bocp = hsh_insert_busyobj(wrk, oh);<br>        /* NB: no deref of objhead, new object inherits reference */<br>        Lck_Unlock(&oh->mtx);<br>        return (HSH_MISS);<br>    }<br></span></span><br><br></div><div class="gmail_default" style="color:rgb(0,0,153)">If busy, is the variable <span style="font-family:monospace,monospace">busy_found</span> set to 0 or 1? For expired objects, it looks like if it is not busy, then you set the return value to <span style="font-family:monospace,monospace">HSH_EXPBUSY</span>, shouldn't it be <span style="font-family:monospace,monospace">HSH_EXP</span>? Can anyone help me understand this piece of code? Because below, the code returns <span style="font-family:monospace,monospace">HSH_MISS</span><br clear="all"></div><br><div style="color:rgb(0,0,153)" class="gmail_default">​Thanks,<br></div><div style="color:rgb(0,0,153)" class="gmail_default">Arvind</div></div>