]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h2: also arm the h2 timeout when sending
authorWilly Tarreau <w@1wt.eu>
Mon, 5 Mar 2018 15:10:54 +0000 (16:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Mar 2018 17:43:56 +0000 (18:43 +0100)
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

index 626739cabcb3b13f6d677002501b85a34a3ecf44..ebefd5200ae2d9f55c2b65936c4ae99a6bf50a54 100644 (file)
@@ -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);
                        }