Commit cfad4788 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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
parent ec14ff3f
......@@ -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;
......
......@@ -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.);
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment