mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MEDIUM: connections: Hold the lock when wanting to kill a connection.
In connect_server(), when we decide we want to kill the connection of another thread because there are too many idle connections, hold the toremove_lock of the corresponding thread, othervise, there's a small race condition where we could try to add the connection to the toremove_connections list while it has already been free'd. This should be backported to 2.0 and 2.1.
This commit is contained in:
parent
37d7897aaf
commit
140237471e
@ -1295,6 +1295,7 @@ int connect_server(struct stream *s)
|
||||
// see it possibly larger.
|
||||
ALREADY_CHECKED(i);
|
||||
|
||||
HA_SPIN_LOCK(OTHER_LOCK, &toremove_lock[tid]);
|
||||
tokill_conn = MT_LIST_POP(&srv->idle_orphan_conns[i],
|
||||
struct connection *, list);
|
||||
if (tokill_conn) {
|
||||
@ -1305,6 +1306,7 @@ int connect_server(struct stream *s)
|
||||
task_wakeup(idle_conn_cleanup[i], TASK_WOKEN_OTHER);
|
||||
break;
|
||||
}
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &toremove_lock[tid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user