Commit 51cee0bf authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Lasse Karstensen

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

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

(cherry picked from commit 969674dc)
parent 29e4a01c
......@@ -952,9 +952,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_obj != NULL)
(void)HSH_DerefObj(&wrk->stats, &bo->ims_obj);
VBO_DerefBusyObj(wrk, &bo);
} else if (mode == VBF_BACKGROUND) {
VBO_waitstate(bo, BOS_REQ_DONE);
} else {
VBO_waitstate(bo, BOS_STREAM);
......
......@@ -237,8 +237,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