]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: servers: Don't forget to set srv_cs to NULL if we can't reuse it.
authorOlivier Houchard <ohouchard@haproxy.com>
Mon, 8 Jul 2019 14:30:32 +0000 (16:30 +0200)
committerOlivier Houchard <cognet@ci0.org>
Mon, 8 Jul 2019 14:32:58 +0000 (16:32 +0200)
In connect_server(), if there were already a CS assosciated with the stream,
but we can't reuse it, because the target is different (because we tried a
previous connection, it failed, and we use redispatch so we switched servers),
don't forget to set srv_cs to NULL. Otherwise, if we end up reusing another
connection, we would consider we already have a conn_stream, and we won't
create a new one, so we'd have a new connection but we would not be able to
use it.
This can explain frozen streams and connections stuck in CLOSE_WAIT when
using redispatch.

This should be backported to 1.9 and 2.0.

src/backend.c

index 37a67c9048d4e539c1fdc42d3408d48746f330cd..05fefcdf37af6c219e51ef270fcca61772702a4f 100644 (file)
@@ -1235,6 +1235,7 @@ int connect_server(struct stream *s)
                        old_conn = srv_conn;
                } else {
                        srv_conn = NULL;
+                       srv_cs = NULL;
                        si_release_endpoint(&s->si[1]);
                }
        }