Ignore:
Timestamp:
2009-01-14 21:40:54 (5 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
master, 3.0, 4.0, experimental-ims
Children:
fd4998
Parents:
afec99
git-author:
Poul-Henning Kamp <phk@…> (2009-01-14 21:40:54)
git-committer:
Poul-Henning Kamp <phk@…> (2009-01-14 21:40:54)
Message:

After HSH_Lookup() returns NULL indicating a busy object, we diddled
the session a bit to transfer the per-request stats to the session
counters with SES_Charge().

Not only was it inconsistent to charge accounting data in the middle
of a request, it was also illegal because after the hash lock was
released we no longer owned the session.

Once a system is under sufficient load that there is a queue for the
CPU, a race could happen where upon hitting a busy object, the hash lock
was released, another thread would schedule, finish the busy object,
start the sessions on the waiting list, finish off the request we had
and then when we get the cpu again and access it, it's gone.

The previous commit (r3512) eliminated the need to call SES_Charge,
this commit removes the (option) shmlog message inside the hash lock
thus, hopefully, eliminating the race that caused #418.

Fixes: #418

git-svn-id:  http://www.varnish-cache.org/svn/trunk/varnish-cache@3513 d4fa192b-c00b-0410-8231-f00ffab90ce4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache_hash.c

    r12a5f09 rf50a341  
    299299                if (sp->esis == 0) 
    300300                        VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list); 
     301                if (params->diag_bitmap & 0x20) 
     302                        WSP(sp, SLT_Debug, 
     303                                "on waiting list <%s>", oh->hash); 
    301304                sp->objhead = oh; 
    302305                Lck_Unlock(&oh->mtx); 
Note: See TracChangeset for help on using the changeset viewer.