[master] varnish-3.0.0-beta1-83-gcfad478
Poul-Henning Kamp
phk at varnish-cache.org
Fri May 27 21:48:35 CEST 2011
commit cfad47881d155111cb38bb049a106d1865e099bd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri May 27 19:47:12 2011 +0000
The persistent stevedore is not even able to allocate an object without
and objcore, so return NULL if asked to.
Add a fallback in cnt_error() to attempt the Transient storage if we
hit this case. There already is a similar retry for the regular
object allocation attempt.
Fixes #915
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 5b19c3e..7f4eedc 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -415,6 +415,9 @@ cnt_error(struct sess *sp)
EXP_Clr(&w->exp);
sp->obj = STV_NewObject(sp, NULL, 1024, &w->exp,
params->http_max_hdr);
+ if (sp->obj == NULL)
+ sp->obj = STV_NewObject(sp, TRANSIENT_STORAGE,
+ 1024, &w->exp, params->http_max_hdr);
if (sp->obj == NULL) {
sp->doclose = "Out of objects";
sp->step = STP_DONE;
diff --git a/bin/varnishd/storage_persistent.c b/bin/varnishd/storage_persistent.c
index 6add1c7..d37ef45 100644
--- a/bin/varnishd/storage_persistent.c
+++ b/bin/varnishd/storage_persistent.c
@@ -474,6 +474,8 @@ smp_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
struct objcore *oc;
unsigned objidx;
+ if (sp->objcore == NULL)
+ return (NULL); /* from cnt_error */
CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC);
AN(sp->objcore);
AN(sp->wrk->exp.ttl > 0.);
diff --git a/bin/varnishtest/tests/r00915.vtc b/bin/varnishtest/tests/r00915.vtc
new file mode 100644
index 0000000..07a39d9
--- /dev/null
+++ b/bin/varnishtest/tests/r00915.vtc
@@ -0,0 +1,24 @@
+varnishtest "error object allocation with persistent"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+shell "rm -f ${tmpdir}/_.per"
+
+varnish v1 \
+ -arg "-pdiag_bitmap=0x20000" \
+ -storage "-spersistent,${tmpdir}/_.per,10m" \
+ -vcl+backend {
+
+ sub vcl_fetch {
+ error(751);
+ }
+} -start
+
+client c1 {
+ txreq -url "/"
+ rxresp
+ expect resp.status == 751
+} -run
More information about the varnish-commit
mailing list