mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-07 01:31:35 +00:00
BUG/MINOR: listener: Wake proxy's mngmt task up if necessary on session release
When a session is released, listener_release() function is called to notify the listener. It is an opportunity to resume limited/full listeners. We first try to resume the listener owning the released session, then all limited listeners in the global queue and finally all limited listeners in the frontend's waiting queue. This last step is only performed if there is no limit applied on the frontend. Nothing is performed if the session rate is still limited. And it is an issue because if this happens for the last listener's session, there is no other event to wake the frontend's managment task up and the listener remains in the limited state. To fix the issue, when a limit is still applied on the frontent, we must compute the new wake up date from the sessions rate and schedule the frontend's managment task. It is easy to reproduce the issue in SSL by setting a maxconn and a rate limit on sessions. This patch should fix the issue #2476. It must be backported to all stable versions.
This commit is contained in:
parent
9c2e900a9b
commit
65ae1347c7
@ -1602,6 +1602,22 @@ void listener_release(struct listener *l)
|
||||
if (fe && !MT_LIST_ISEMPTY(&fe->listener_queue) &&
|
||||
(!fe->fe_sps_lim || freq_ctr_remain(&fe->fe_sess_per_sec, fe->fe_sps_lim, 0) > 0))
|
||||
dequeue_proxy_listeners(fe);
|
||||
else {
|
||||
unsigned int wait;
|
||||
int expire = TICK_ETERNITY;
|
||||
|
||||
if (fe->fe_sps_lim &&
|
||||
(wait = next_event_delay(&fe->fe_sess_per_sec,fe->fe_sps_lim, 0))) {
|
||||
/* we're blocking because a limit was reached on the number of
|
||||
* requests/s on the frontend. We want to re-check ASAP, which
|
||||
* means in 1 ms before estimated expiration date, because the
|
||||
* timer will have settled down.
|
||||
*/
|
||||
expire = tick_first(fe->task->expire, tick_add(now_ms, wait));
|
||||
if (fe->task && tick_isset(expire))
|
||||
task_schedule(fe->task, expire);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initializes the listener queues. Returns 0 on success, otherwise ERR_* flags */
|
||||
|
Loading…
Reference in New Issue
Block a user