--- varnish-2.0.3/bin/varnishd/stevedore.c	2009-02-12 05:15:25.000000000 -0600
+++ programming/varnish/bin/varnishd/stevedore.c	2009-07-12 20:21:46.970054000 -0500
@@ -46,18 +46,21 @@
 STV_alloc(struct sess *sp, size_t size)
 {
 	struct storage *st;
-	struct stevedore *stv;
+	struct stevedore *stv = NULL;
+	unsigned fail = 0;
 
 	for (;;) {
-
-		/* pick a stevedore and bump the head along */
-		stv = VTAILQ_NEXT(stv_next, list);
-		if (stv == NULL)
-			stv = VTAILQ_FIRST(&stevedores);
-		AN(stv);
-
-		 /* XXX: only safe as long as pointer writes are atomic */
-		stv_next = stv;
+		if(stv==NULL){
+			/* pick a stevedore and bump the head along */
+			stv = VTAILQ_NEXT(stv_next, list);
+			if (stv == NULL)
+				stv = VTAILQ_FIRST(&stevedores);
+			AN(stv);
+
+			 /* XXX: only safe as long as pointer writes are atomic */
+			stv_next = stv;
+			fail=0;
+		}
 
 		/* try to allocate from it */
 		st = stv->alloc(stv, size);
@@ -65,9 +68,18 @@
 			break;
 
 		/* no luck; try to free some space and keep trying */
-		if (EXP_NukeOne(sp) == -1)
-			break;
+		/* Try Nuking 50 things from a stack. If a Nuke fails 
+		   or there is still not enough space after 50 nukes
+		   try next stack.  Do NOT make an assertion.
+		   -- Kal McFate */
+		if (EXP_NukeOne(sp) == -1){
+			stv = NULL;
+			usleep(1);
+		}
+		if(++fail == 50)
+			stv = NULL;
 	}
+	/* This is where it's dumping out because the st is NULL */
 	CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
 	return (st);
 }
