mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-13 17:39:21 -04:00
Muxes are responsible to release connections once they are inactive and won't be reusable. In QUIC mux, such connections are detected via qcc_is_dead(). The first precondition is that there is no more upper streams attached. This was accounted via QCC <nb_sc> counter. A special characteristic of QCS instances is that they can be in detached state : upper stream has been removed but there is still data to emit. Such QCS were not taken into account in qcc_is_dead(), so a connection could be freed with some remaining data not yet emitted. It is also not possible for QUIC MUX to simply look at the QCS tree to determine if the connection is inactive. Indeed, some streams are opened for protocol internal usage. This is the case for example with HTTP/3 unidirectional control stream or QPACK encoder/decoder streams. These streams are never closed. In the end, only requests streams should be taken into account for the connection activity. This patch improves the situation by reworking <nb_hreq> QCC counter. Previously, it served for http-request timeout implementation. However, this timeout only relies on <opening_list> now. Thus, <nb_hreq> scope is changed : it is now incremented via qcs_wait_http_req(), used by app protocol layer once a request stream is identified. Decrement is performed on qcs_free(), so this guarantees that a connection cannot be freed anymore if request streams still exists, unless if inactivity timeout fires. As such, <nb_hreq> now supersedes <nb_sc> entirely, so the qcc_is_dead() can now relies on the former. Along with this change, qcc_timeout_task() must be updated. Call to qcc_is_dead() was unnecessary prior to this patch as timeout handling was only active when no upper streams were attached. When tested, both <nb_sc> and QCC <task> were already null, so a connection was always released on timeout, as expected. With qcc_is_dead() now checking <nb_hreq> instead, this is not always the case anymore. In fact, this check is unnecessary as inactivity timeout serves precisely to free a stucked connection with remaining data to emit. This patch also has some impact on http-keep-alive timeout. Previously, this timeout could be armed if only detached streams remained. Now, it is only applicable if all QCS request instances are closed and freed. Thus, qcc_reset_idle_start() is now closed directly on qcs_free(). Ideally this should be backported up to 2.6, or at least 2.8 as QUIC experimental status was removed there. |
||
|---|---|---|
| .. | ||
| haproxy | ||
| import | ||
| make | ||