From c1d7fb60f3eff9b9d40d28a27e41450d3b20d50c Mon Sep 17 00:00:00 2001 From: des Date: Tue, 17 Jul 2007 17:06:12 +0000 Subject: [PATCH] Assert that LRU_DiscardOne() returns 1, to avoid an unlikely but possible scenario where multiple clients each require different objects such that the sum of the sizes of the objects is larger than the cache (or, in the extreme case, one client requests an object which is larger than the cache) causing STV_alloc() to enter an infinite loop. This is not ideal - a better solution would be return NULL and have the caller deal with the problem, possibly by returning a 503 result, or by stalling the request for some time. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1714 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/stevedore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/stevedore.c b/varnish-cache/bin/varnishd/stevedore.c index 55bb3f44..e609346f 100644 --- a/varnish-cache/bin/varnishd/stevedore.c +++ b/varnish-cache/bin/varnishd/stevedore.c @@ -39,7 +39,7 @@ STV_alloc(size_t size) AN(stevedore->alloc); do { if ((st = stevedore->alloc(stevedore, size)) == NULL) - LRU_DiscardOne(); + AN(LRU_DiscardOne()); } while (st == NULL); return (st); } -- 2.39.5