From cc156623b2ed80338e3ad460db3aba55605ac55f Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 7 Jan 2019 14:07:29 +0100 Subject: [PATCH] BUG/MEDIUM: cache/htx: Respect the reserve when cached objects are served It is only true for HTX streams. The legacy code relies on ci_putblk() which is already aware of the reserve. It is mandatory to not fill the reserve to let other filters analysing data. It is especially true for the compression filter. It needs at least 20 bytes of free space, plus at most 5 bytes per 32kB block. So if the cache fully fills the channel's buffer, the compression will not have enough space to do its job and it will block the data forwarding, waiting for more free space. But if the buffer fully filled with input data (ie no outgoing data), the stream will be frozen infinitely. This patch must be backported to 1.9. It depends on the following patches: * BUG/MEDIUM: cache/htx: Respect the reserve when cached objects are served from the cache * MINOR: channel/htx: Add HTX version for some helper functions --- src/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index 77e411f59..0002d9739 100644 --- a/src/cache.c +++ b/src/cache.c @@ -900,7 +900,7 @@ static size_t htx_cache_dump_data(struct appctx *appctx, struct htx *htx, struct cache_flt_conf *cconf = appctx->rule->arg.act.p[0]; struct shared_context *shctx = shctx_ptr(cconf->c.cache); struct shared_block *shblk = appctx->ctx.cache.next; - uint32_t max = htx_free_data_space(htx); + uint32_t max = channel_htx_recv_max(si_ic(appctx->owner), htx); unsigned int offset; size_t total = 0;