mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-22 12:30:07 +00:00
BUG/MINOR: backend: fix wrong BUG_ON for avail conn
Idle connections are both stored in an idle/safe tree and in an idle list. The list is used as a secondary storage to be able to retrieve them by usage order. If a connection is moved into the available tree, it must not be present in the idle list. A BUG_ON() was written to check this but was placed at the wrong code section. Fix this by removing the misplaced one and write new ones for avail_conns tree insertion and lookup. The impact of this bug is minor as the misplaced BUG_ON() did not seem to be triggered. No need to backport.
This commit is contained in:
parent
8da0e45382
commit
b9fbbaf2a8
@ -1457,6 +1457,9 @@ static int connect_server(struct stream *s)
|
||||
if (!eb_is_empty(&srv->per_thr[tid].avail_conns)) {
|
||||
srv_conn = srv_lookup_conn(&srv->per_thr[tid].avail_conns, hash);
|
||||
if (srv_conn) {
|
||||
/* connection cannot be in idle list if used as an avail idle conn. */
|
||||
BUG_ON(LIST_INLIST(&srv_conn->idle_list));
|
||||
|
||||
DBG_TRACE_STATE("reuse connection from avail", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
|
||||
reuse = 1;
|
||||
}
|
||||
@ -1564,9 +1567,6 @@ static int connect_server(struct stream *s)
|
||||
int avail = srv_conn->mux->avail_streams(srv_conn);
|
||||
|
||||
if (avail <= 1) {
|
||||
/* connection cannot be in idle list if used as an avail idle conn. */
|
||||
BUG_ON(LIST_INLIST(&srv_conn->idle_list));
|
||||
|
||||
/* No more streams available, remove it from the list */
|
||||
HA_SPIN_LOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock);
|
||||
conn_delete_from_tree(srv_conn);
|
||||
|
Loading…
Reference in New Issue
Block a user