From 84b118f3120b3c61156f0ada12ae6456bd1a0b5a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 5 Mar 2018 16:10:54 +0100 Subject: [PATCH] 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. --- src/mux_h2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index 626739cab..ebefd5200 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); } -- 2.47.3