BUG/MEDIUM: mux-h2: always process a pending shut read
authorWilly Tarreau <w@1wt.eu>
Fri, 19 Nov 2021 10:41:10 +0000 (11:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 23 Nov 2021 15:34:07 +0000 (16:34 +0100)
commit3b7f63a17a89c9390af2b53e1f1f37974fc7e151
treef2db0cf965aed2783ca53f139d94e57df08cd0e1
parent474762f9d1c5fd61e60c795824dc9fb15e961778
BUG/MEDIUM: mux-h2: always process a pending shut read

During 2.4-dev, an issue with partial frames was fixed with commit
3d4631fec ("BUG/MEDIUM: mux-h2: fix read0 handling on partial frames").
However this patch is not completely correct. It makes h2_recv() return
0 if the connection was shut for reads, but this not make h2_io_cb()
call h2_process(), so if there are any pending data left in the demux
buffer, they will never be processed, and the I/O callback will be
called in loops forever from the poller.

The correct return value there is 1, as is done at the end of the
function to report a pending read0.

This should definitely fix issue #1328. However even after a lot of
tests I couldn't manage to reproduce it, the conditions to enter that
situation are quite racy.

This must be backported to 2.0 since the fix above was merged into
2.0.21 and 2.2.9.

(cherry picked from commit 3a8bbcc38e3fe623fe9a9f2d61f483d4e3936fc5)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 49acac00e81027b44730a97927f7e5b2166b84ab)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/mux_h2.c