]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: muxes: Note that we can't usee a connection when added to the srv idle.
authorOlivier Houchard <cognet@ci0.org>
Sun, 22 Mar 2020 22:25:51 +0000 (23:25 +0100)
committerOlivier Houchard <cognet@ci0.org>
Sun, 22 Mar 2020 22:25:51 +0000 (23:25 +0100)
In the various muxes, add a comment documenting that once
srv_add_to_idle_list() got called, any thread may pick that conenction up,
so it is unsafe to access the mux context/the connection, the only thing we
can do is returning.

src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c

index 993e02cca4ce1e1d9122754ecf65e572fb4910c6..b7afde1b87a02831b6f7bcf1ebb7e70d5193e747 100644 (file)
@@ -3558,6 +3558,10 @@ static void fcgi_detach(struct conn_stream *cs)
                                        TRACE_DEVEL("outgoing connection killed", FCGI_EV_STRM_END|FCGI_EV_FCONN_ERR);
                                        return;
                                }
+                               /* At this point, the connection has been added to the
+                                * server idle list, so another thread may already have
+                                * hijacked it, so we can't do anything with it.
+                                */
                                TRACE_DEVEL("reusable idle connection", FCGI_EV_STRM_END, fconn->conn);
                                return;
                        }
index fee645b191a3459361c2b2fc485c9dae3a55cc29..27b1cb674bf809b965c55ed9a64c80fe127ae471 100644 (file)
@@ -2473,6 +2473,10 @@ static void h1_detach(struct conn_stream *cs)
                                TRACE_DEVEL("outgoing connection killed", H1_EV_STRM_END|H1_EV_H1C_END);
                                goto end;
                        }
+                       /* At this point, the connection has been added to the
+                        * server idle list, so another thread may already have
+                        * hijacked it, so we can't do anything with it.
+                        */
                        return;
                }
        }
index d10c525c90fa90b835638dc08281b586859b5281..6b1c0d1184d45cf070a69f9096b430ff47918774 100644 (file)
@@ -3959,6 +3959,10 @@ static void h2_detach(struct conn_stream *cs)
                                                TRACE_DEVEL("leaving on error after killing outgoing connection", H2_EV_STRM_END|H2_EV_H2C_ERR);
                                                return;
                                        }
+                                       /* At this point, the connection has been added to the
+                                        * server idle list, so another thread may already have
+                                        * hijacked it, so we can't do anything with it.
+                                        */
                                        TRACE_DEVEL("reusable idle connection", H2_EV_STRM_END);
                                        return;