r1714 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Jul 17 19:06:12 CEST 2007


Author: des
Date: 2007-07-17 19:06:12 +0200 (Tue, 17 Jul 2007)
New Revision: 1714

Modified:
   trunk/varnish-cache/bin/varnishd/stevedore.c
Log:
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.


Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2007-07-17 16:58:40 UTC (rev 1713)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2007-07-17 17:06:12 UTC (rev 1714)
@@ -39,7 +39,7 @@
 	AN(stevedore->alloc);
 	do {
 		if ((st = stevedore->alloc(stevedore, size)) == NULL)
-			LRU_DiscardOne();
+			AN(LRU_DiscardOne());
 	} while (st == NULL);
 	return (st);
 }




More information about the varnish-commit mailing list