From d6f0557deb671f8a4e5228ac7e107916a555c436 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 9 May 2023 11:31:24 +0200 Subject: [PATCH] BUG/MEDIUM: cache: Don't request more room than the max allowed Since a recent change on the SC API, a producer must specify the amount of free space it needs to progress when it is blocked. But, it must take care to never exceed the maximum size allowed in the buffer. Otherwise, the stream is freezed because it cannot reach the condition to unblock the producer. In this context, there is a bug in the cache applet when it fails to dump a message. It may request more space than allowed. It happens when the cached object is too big. It is a 2.8-specific bug. No backport needed. --- src/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index cebd17e3de..8118387c9f 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1513,7 +1513,7 @@ static void http_cache_io_handler(struct appctx *appctx) if (len) { ret = htx_cache_dump_msg(appctx, res_htx, len, HTX_BLK_UNUSED); if (ret < len) { - sc_need_room(sc, len - ret); + sc_need_room(sc, channel_htx_recv_max(res, res_htx) + 1); goto out; } }