[master] 9cfe535 If we fail to allocate an object, attempt to create a shortlived object in Transient storage and if that also fails, 503.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Apr 4 11:22:59 CEST 2011
commit 9cfe535f67ef42d7f5dc09b0e6721bfd77316331
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 4 09:22:12 2011 +0000
If we fail to allocate an object, attempt to create a shortlived
object in Transient storage and if that also fails, 503.
Fixes 879
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 7c4cb32..ba418b6 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -689,7 +689,22 @@ cnt_fetchbody(struct sess *sp)
sp->obj = STV_NewObject(sp, sp->wrk->storage_hint, l,
&sp->wrk->exp, nhttp);
- /* XXX: -> 513 */
+ if (sp->obj == NULL) {
+ /*
+ * Try to salvage the transaction by allocating a
+ * shortlived object on Transient storage.
+ */
+ sp->obj = STV_NewObject(sp, TRANSIENT_STORAGE, l,
+ &sp->wrk->exp, nhttp);
+ sp->wrk->exp.ttl = params->shortlived;
+ }
+ if (sp->obj == NULL) {
+ HSH_Drop(sp);
+ sp->err_code = 503;
+ sp->step = STP_ERROR;
+ VDI_CloseFd(sp);
+ return (0);
+ }
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
sp->wrk->storage_hint = NULL;
More information about the varnish-commit
mailing list