From: des Date: Tue, 17 Jul 2007 17:06:12 +0000 (+0000) Subject: Assert that LRU_DiscardOne() returns 1, to avoid an unlikely but possible X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1d7fb60f3eff9b9d40d28a27e41450d3b20d50c;p=varnish 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 --- 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); }