mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 12:41:00 +02:00
BUG/MEDIUM: quic: prevent stream freeze on pacing
On snd_buf completion, QUIC MUX tasklet is scheduled if newly data has been transferred from the stream layer. Thanks to qcc_wakeup(), pacing status is removed from tasklet, which ensure next emission will reset Tx frames and use the new data. Tasklet is not scheduled if MUX is already subscribed on send due to a previous blocking condition. This is an optimization to prevent an unneeded IO handler execution. However, this causes a bug if an emission is currently delayed due to pacing. As pacing status is not removed on snd_buf, next emission process will continue emission with older data without refreshing the newly transferred one. This causes a transfer freeze. Unless there is some activity on the connection, the transfer will be eventually aborted due to idle timeout. To fix this, remove TASK_F_USR1 if tasklet wakeup is not called due to send subscription. Note that this code is also duplicated in done_ff for zero-copy transfer. This must be backported up to 3.1.
This commit is contained in:
parent
dd56616067
commit
9d4c26ebaa
@ -3254,8 +3254,15 @@ static size_t qmux_strm_snd_buf(struct stconn *sc, struct buffer *buf,
|
||||
const size_t data = qcs_prep_bytes(qcs) - old_data;
|
||||
if (data || fin)
|
||||
qcc_send_stream(qcs, 0, data);
|
||||
|
||||
/* Wake up MUX to emit newly transferred data. If blocked on
|
||||
* send, ensure next emission will refresh data by removing
|
||||
* pacing status info.
|
||||
*/
|
||||
if (!(qcs->qcc->wait_event.events & SUB_RETRY_SEND))
|
||||
qcc_wakeup(qcs->qcc);
|
||||
else
|
||||
HA_ATOMIC_AND(&qcs->qcc->wait_event.tasklet->state, ~TASK_F_USR1);
|
||||
}
|
||||
|
||||
end:
|
||||
@ -3375,8 +3382,12 @@ static size_t qmux_strm_done_ff(struct stconn *sc)
|
||||
|
||||
if (data || qcs->flags & QC_SF_FIN_STREAM)
|
||||
qcc_send_stream(qcs, 0, data);
|
||||
|
||||
/* Similar to snd_buf callback. */
|
||||
if (!(qcs->qcc->wait_event.events & SUB_RETRY_SEND))
|
||||
qcc_wakeup(qcc);
|
||||
else
|
||||
HA_ATOMIC_AND(&qcs->qcc->wait_event.tasklet->state, ~TASK_F_USR1);
|
||||
|
||||
end:
|
||||
TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user