BUG/MINOR: cache: Disable cache if applet creation fails

When we want to serve a resource from the cache, if the applet creation
fails, the "cache-use" action must not yield. Otherwise, the stream will
hang. Instead, we now disable the cache. Thus the request may be served by
the server.

This patch must be backported as far as 1.8.
This commit is contained in:
Christopher Faulet 2022-04-21 11:30:43 +02:00
parent 02ef0ff061
commit 1d216c7ec1

View File

@ -1830,10 +1830,11 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p
_HA_ATOMIC_INC(&px->be_counters.p.http.cache_hits); _HA_ATOMIC_INC(&px->be_counters.p.http.cache_hits);
return ACT_RET_CONT; return ACT_RET_CONT;
} else { } else {
s->target = NULL;
shctx_lock(shctx_ptr(cache)); shctx_lock(shctx_ptr(cache));
shctx_row_dec_hot(shctx_ptr(cache), entry_block); shctx_row_dec_hot(shctx_ptr(cache), entry_block);
shctx_unlock(shctx_ptr(cache)); shctx_unlock(shctx_ptr(cache));
return ACT_RET_YIELD; return ACT_RET_CONT;
} }
} }
shctx_unlock(shctx_ptr(cache)); shctx_unlock(shctx_ptr(cache));