mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-17 20:45:40 +00:00
Revert "MEDIUM: queue: refine the locking in process_srv_queue()"
This reverts commit1b648c857b
. The recent changes since5304669e1
MEDIUM: queue: make pendconn_process_next_strm() only return the pendconn opened a tiny race condition between stream_free() and process_srv_queue(), as the pendconn is accessed outside of the lock, possibly while it's being freed. A different approach is required.
This commit is contained in:
parent
3f70fb9ea2
commit
e76fc3253d
16
src/queue.c
16
src/queue.c
@ -340,29 +340,27 @@ void process_srv_queue(struct server *s, int server_locked)
|
||||
int done = 0;
|
||||
int maxconn;
|
||||
|
||||
if (!server_locked)
|
||||
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
|
||||
HA_RWLOCK_WRLOCK(PROXY_LOCK, &p->lock);
|
||||
maxconn = srv_dynamic_maxconn(s);
|
||||
while (s->served < maxconn) {
|
||||
struct pendconn *pc;
|
||||
|
||||
if (!server_locked)
|
||||
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
|
||||
HA_RWLOCK_WRLOCK(PROXY_LOCK, &p->lock);
|
||||
|
||||
pc = pendconn_process_next_strm(s, p);
|
||||
|
||||
HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &p->lock);
|
||||
if (!server_locked)
|
||||
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
||||
|
||||
if (!pc)
|
||||
break;
|
||||
|
||||
done++;
|
||||
|
||||
_HA_ATOMIC_INC(&s->served);
|
||||
|
||||
stream_add_srv_conn(pc->strm, s);
|
||||
task_wakeup(pc->strm->task, TASK_WOKEN_RES);
|
||||
}
|
||||
HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &p->lock);
|
||||
if (!server_locked)
|
||||
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
||||
|
||||
_HA_ATOMIC_ADD(&p->served, done);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user