]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cache/htx: Respect the reserve when cached objects are served
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 7 Jan 2019 13:07:29 +0000 (14:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 7 Jan 2019 15:32:07 +0000 (16:32 +0100)
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

index 77e411f59492e42ce83654680bba46da5b3bcc86..0002d9739b1732c3f7aace944d09cb99187173c6 100644 (file)
@@ -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;