From: Willy Tarreau Date: Mon, 5 Mar 2018 15:10:54 +0000 (+0100) Subject: BUG/MEDIUM: h2: also arm the h2 timeout when sending X-Git-Tag: v1.9-dev1~382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84b118f3120b3c61156f0ada12ae6456bd1a0b5a;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: h2: also arm the h2 timeout when sending Right now the h2 idle timeout is only set when there is no stream. If we fail to send because the socket buffers are full (generally indicating the client has left), we also need to arm it so that we can properly expire such connections, otherwise some failed transfers might leave H2 connections pending forever. Thanks to Thierry Fournier for the diag and the traces. This patch needs to be backported to 1.8. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 626739cabc..ebefd5200a 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -2297,7 +2297,7 @@ static int h2_wake(struct connection *conn) } if (h2c->task) { - if (eb_is_empty(&h2c->streams_by_id)) { + if (eb_is_empty(&h2c->streams_by_id) || h2c->mbuf->o) { h2c->task->expire = tick_add(now_ms, h2c->last_sid < 0 ? h2c->timeout : h2c->shut_timeout); task_queue(h2c->task); } @@ -2468,7 +2468,7 @@ static void h2_detach(struct conn_stream *cs) h2_release(h2c->conn); } else if (h2c->task) { - if (eb_is_empty(&h2c->streams_by_id)) { + if (eb_is_empty(&h2c->streams_by_id) || h2c->mbuf->o) { h2c->task->expire = tick_add(now_ms, h2c->last_sid < 0 ? h2c->timeout : h2c->shut_timeout); task_queue(h2c->task); }