[master] abcbc03 Don't call SES_NewPool() until there is at least one idle thread in the thread pool.

Poul-Henning Kamp phk at FreeBSD.org
Wed Mar 18 15:06:05 CET 2015


commit abcbc03c888256f7dedd4a26bcec0b3278e45538
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 18 13:55:10 2015 +0000

    Don't call SES_NewPool() until there is at least one idle thread
    in the thread pool.

diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index 762685b..c05d6c7 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -471,6 +471,7 @@ pool_herder(void *priv)
 			pool_breed(pp);
 			continue;
 		}
+		assert(pp->nthr >= cache_param->wthread_min);
 
 		if (pp->nthr > cache_param->wthread_min) {
 
@@ -549,6 +550,9 @@ pool_mkpool(unsigned pool_no)
 	AZ(pthread_cond_init(&pp->herder_cond, NULL));
 	AZ(pthread_create(&pp->herder_thr, NULL, pool_herder, pp));
 
+	while (VTAILQ_EMPTY(&pp->idle_queue))
+		usleep(10000);
+
 	pp->sesspool = SES_NewPool(pp, pool_no);
 	AN(pp->sesspool);
 



More information about the varnish-commit mailing list