[master] 9fbcb4e If we fail to reschedule from the waiting list, we ditch the entire waiting list in an attempt to recover.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Oct 20 14:54:38 CEST 2014
commit 9fbcb4e94942a1bc7ff540f0a475b057a616b1ae
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Oct 20 12:53:43 2014 +0000
If we fail to reschedule from the waiting list, we ditch the entire
waiting list in an attempt to recover.
This also fixes buglet in previous commit which failed to call
CNT_AcctLogCharge()
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 2c5592f..5f603b1 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -517,6 +517,7 @@ hsh_rush(struct worker *wrk, struct objhead *oh)
{
unsigned u;
struct req *req;
+ struct sess *sp;
struct waitinglist *wl;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
@@ -533,8 +534,29 @@ hsh_rush(struct worker *wrk, struct objhead *oh)
AZ(req->wrk);
VTAILQ_REMOVE(&wl->list, req, w_list);
DSL(DBG_WAITINGLIST, req->vsl->wid, "off waiting list");
- if (SES_ScheduleReq(req))
+ if (SES_ScheduleReq(req)) {
+ /*
+ * In case of overloads, we ditch the entire
+ * waiting list.
+ */
+ while (1) {
+ AN (req->vcl);
+ VCL_Rel(&req->vcl);
+ sp = req->sp;
+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ CNT_AcctLogCharge(wrk->stats, req);
+ SES_ReleaseReq(req);
+ SES_Delete(sp, SC_OVERLOAD, NAN);
+ req = VTAILQ_FIRST(&wl->list);
+ if (req == NULL)
+ break;
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ VTAILQ_REMOVE(&wl->list, req, w_list);
+ DSL(DBG_WAITINGLIST, req->vsl->wid,
+ "kill from waiting list");
+ }
break;
+ }
}
if (VTAILQ_EMPTY(&wl->list)) {
oh->waitinglist = NULL;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index ef3f11b..04a4ca5 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -238,14 +238,7 @@ SES_ScheduleReq(struct req *req)
sp->task.func = ses_req_pool_task;
sp->task.priv = req;
- if (Pool_Task(pp->pool, &sp->task, POOL_QUEUE_FRONT)) {
- AN (req->vcl);
- VCL_Rel(&req->vcl);
- SES_ReleaseReq(req);
- SES_Delete(sp, SC_OVERLOAD, NAN);
- return (1);
- }
- return (0);
+ return (Pool_Task(pp->pool, &sp->task, POOL_QUEUE_FRONT));
}
/*--------------------------------------------------------------------
More information about the varnish-commit
mailing list