mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: backend: hold correctly lock when killing idle conn
The wrong lock seems to be held when trying to remove another thread connection if max fd limit has been reached (locking the current thread instead of the target thread lock). This could be backported up to 2.0.
This commit is contained in:
parent
cd7126b396
commit
a3bf62ec54
@ -1350,22 +1350,23 @@ int connect_server(struct stream *s)
|
|||||||
// see it possibly larger.
|
// see it possibly larger.
|
||||||
ALREADY_CHECKED(i);
|
ALREADY_CHECKED(i);
|
||||||
|
|
||||||
HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
|
HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
|
||||||
tokill_conn = MT_LIST_POP(&srv->idle_conns[i],
|
tokill_conn = MT_LIST_POP(&srv->idle_conns[i],
|
||||||
struct connection *, list);
|
struct connection *, list);
|
||||||
if (!tokill_conn)
|
if (!tokill_conn)
|
||||||
tokill_conn = MT_LIST_POP(&srv->safe_conns[i],
|
tokill_conn = MT_LIST_POP(&srv->safe_conns[i],
|
||||||
struct connection *, list);
|
struct connection *, list);
|
||||||
|
|
||||||
if (tokill_conn) {
|
if (tokill_conn) {
|
||||||
/* We got one, put it into the concerned thread's to kill list, and wake it's kill task */
|
/* We got one, put it into the concerned thread's to kill list, and wake it's kill task */
|
||||||
|
|
||||||
MT_LIST_ADDQ(&idle_conns[i].toremove_conns,
|
MT_LIST_ADDQ(&idle_conns[i].toremove_conns,
|
||||||
(struct mt_list *)&tokill_conn->list);
|
(struct mt_list *)&tokill_conn->list);
|
||||||
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
|
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
|
||||||
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
|
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
|
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user