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.
This commit is contained in:
Christopher Faulet 2023-05-09 11:31:24 +02:00
parent 7a01ff7921
commit d6f0557deb
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}
}