[master] 68aad88 Compare the state of a pool with the parameters

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Sep 4 10:18:06 CEST 2017


commit 68aad883e7678e8b59c8ff1e08d04cff9ec9e304
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Aug 22 17:45:56 2017 +0200

    Compare the state of a pool with the parameters
    
    This patch fixes the queuing logic of tasks. Depending on the various
    thread pool parameters, it could exceed up to `thread_pool_max` tasks
    in the queue.

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 0da3ce7..88fb942 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -269,8 +269,8 @@ Pool_Task(struct pool *pp, struct pool_task *task, enum task_prio prio)
 	 * work is vital and needs do be done at the earliest
 	 */
 	if (prio != TASK_QUEUE_REQ ||
-	    pp->lqueue < cache_param->wthread_max +
-	    cache_param->wthread_queue_limit + pp->nthr) {
+	    pp->lqueue + pp->nthr < cache_param->wthread_max +
+	    cache_param->wthread_queue_limit) {
 		pp->nqueued++;
 		pp->lqueue++;
 		VTAILQ_INSERT_TAIL(&pp->queues[prio], task, list);



More information about the varnish-commit mailing list