Commit 969674dc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't attempt to run the fetch in the request thread if there are

no threads available in the pool, fail the fetch and count it.

Fixes #1620
Fixes #1621
parent 06592130
......@@ -957,9 +957,13 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
bo->fetch_task.priv = bo;
bo->fetch_task.func = vbf_fetch_thread;
if (Pool_Task(wrk->pool, &bo->fetch_task, POOL_QUEUE_FRONT))
vbf_fetch_thread(wrk, bo);
if (mode == VBF_BACKGROUND) {
if (Pool_Task(wrk->pool, &bo->fetch_task, POOL_QUEUE_FRONT)) {
wrk->stats->fetch_no_thread++;
(void)vbf_stp_fail(req->wrk, bo);
if (bo->ims_oc != NULL)
(void)HSH_DerefObjCore(wrk, &bo->ims_oc);
VBO_DerefBusyObj(wrk, &bo);
} else if (mode == VBF_BACKGROUND) {
VBO_waitstate(bo, BOS_REQ_DONE);
} else {
VBO_waitstate(bo, BOS_STREAM);
......
......@@ -228,8 +228,12 @@ VSC_F(fetch_304, uint64_t, 1, 'c', info,
"beresp with no body because of 304 response."
)
VSC_F(fetch_failed, uint64_t, 1, 'c', info,
"Fetch body failed",
"beresp body fetch failed."
"Fetch failed (all causes)",
"beresp fetch failed."
)
VSC_F(fetch_no_thread, uint64_t, 1, 'c', info,
"Fetch failed (no thread)",
"beresp fetch failed, no thread available."
)
/*---------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment