diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 9b4827174..fd74b56af 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -3140,8 +3140,10 @@ struct task *fcgi_timeout_task(struct task *t, void *context, unsigned int state /* We're about to destroy the connection, so make sure nobody attempts * to steal it from us. */ - if (fconn->conn->flags & CO_FL_LIST_MASK) + if (fconn->conn->flags & CO_FL_LIST_MASK) { conn_delete_from_tree(&fconn->conn->hash_node->node); + fconn->conn->flags &= ~CO_FL_LIST_MASK; + } HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } diff --git a/src/mux_h1.c b/src/mux_h1.c index f9bd1d88b..455f62384 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3297,8 +3297,10 @@ struct task *h1_timeout_task(struct task *t, void *context, unsigned int state) /* We're about to destroy the connection, so make sure nobody attempts * to steal it from us. */ - if (h1c->conn->flags & CO_FL_LIST_MASK) + if (h1c->conn->flags & CO_FL_LIST_MASK) { conn_delete_from_tree(&h1c->conn->hash_node->node); + h1c->conn->flags &= ~CO_FL_LIST_MASK; + } HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } diff --git a/src/mux_h2.c b/src/mux_h2.c index 4ac7fc5da..293c41447 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -4031,6 +4031,7 @@ static int h2_process(struct h2c *h2c) if (conn->flags & CO_FL_LIST_MASK) { HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); conn_delete_from_tree(&conn->hash_node->node); + conn->flags &= ~CO_FL_LIST_MASK; HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } } @@ -4039,6 +4040,7 @@ static int h2_process(struct h2c *h2c) if (conn->flags & CO_FL_LIST_MASK) { HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); conn_delete_from_tree(&conn->hash_node->node); + conn->flags &= ~CO_FL_LIST_MASK; HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } } @@ -4118,8 +4120,10 @@ struct task *h2_timeout_task(struct task *t, void *context, unsigned int state) /* We're about to destroy the connection, so make sure nobody attempts * to steal it from us. */ - if (h2c->conn->flags & CO_FL_LIST_MASK) + if (h2c->conn->flags & CO_FL_LIST_MASK) { conn_delete_from_tree(&h2c->conn->hash_node->node); + h2c->conn->flags &= ~CO_FL_LIST_MASK; + } HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } @@ -4172,6 +4176,7 @@ do_leave: if (h2c->conn->flags & CO_FL_LIST_MASK) { HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); conn_delete_from_tree(&h2c->conn->hash_node->node); + h2c->conn->flags &= ~CO_FL_LIST_MASK; HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); } diff --git a/src/server.c b/src/server.c index 6e9d5113f..45fc33fa3 100644 --- a/src/server.c +++ b/src/server.c @@ -5828,6 +5828,7 @@ static int srv_migrate_conns_to_remove(struct eb_root *idle_tree, struct mt_list hash_node = ebmb_entry(node, struct conn_hash_node, node); eb_delete(node); + hash_node->conn->flags &= ~CO_FL_LIST_MASK; MT_LIST_APPEND(toremove_list, &hash_node->conn->toremove_list); i++; @@ -5885,6 +5886,7 @@ void srv_release_conn(struct server *srv, struct connection *conn) /* Remove the connection from any tree (safe, idle or available) */ HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); conn_delete_from_tree(&conn->hash_node->node); + conn->flags &= ~CO_FL_LIST_MASK; HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock); }