mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
[BUG] event pollers must not wait if a task exists in the run queue
Under some circumstances, a task may already lie in the run queue (eg: inter-task wakeup). It is disastrous to wait for an event in this case because some processing gets delayed.
This commit is contained in:
parent
5c6f58fe87
commit
3a6281199a
@ -232,7 +232,9 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
|
||||
fd_flush_changes();
|
||||
|
||||
/* now let's wait for events */
|
||||
if (tv_iseternity(exp))
|
||||
if (run_queue)
|
||||
wait_time = 0;
|
||||
else if (tv_iseternity(exp))
|
||||
wait_time = -1;
|
||||
else if (tv_isge(&now, exp))
|
||||
wait_time = 0;
|
||||
|
@ -106,7 +106,11 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
|
||||
struct timespec timeout, *to_ptr;
|
||||
|
||||
to_ptr = NULL; // no timeout
|
||||
if (tv_isset(exp)) {
|
||||
if (run_queue) {
|
||||
timeout.tv_sec = timeout.tv_nsec = 0;
|
||||
to_ptr = &timeout;
|
||||
}
|
||||
else if (tv_isset(exp)) {
|
||||
struct timeval delta;
|
||||
|
||||
if (tv_isge(&now, exp))
|
||||
|
@ -124,7 +124,9 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
|
||||
}
|
||||
|
||||
/* now let's wait for events */
|
||||
if (tv_iseternity(exp))
|
||||
if (run_queue)
|
||||
wait_time = 0;
|
||||
else if (tv_iseternity(exp))
|
||||
wait_time = -1;
|
||||
else if (tv_isge(&now, exp))
|
||||
wait_time = 0;
|
||||
|
@ -89,7 +89,7 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
|
||||
|
||||
/* allow select to return immediately when needed */
|
||||
delta.tv_sec = delta.tv_usec = 0;
|
||||
if (tv_isset(exp)) {
|
||||
if (!run_queue && tv_isset(exp)) {
|
||||
if (tv_islt(&now, exp)) {
|
||||
tv_remain(&now, exp, &delta);
|
||||
/* To avoid eventual select loops due to timer precision */
|
||||
|
@ -424,9 +424,10 @@ REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
|
||||
}
|
||||
last_skipped = 0;
|
||||
|
||||
if (nbspec || status) {
|
||||
if (nbspec || status || run_queue) {
|
||||
/* Maybe we have processed some events that we must report, or
|
||||
* maybe we still have events in the spec list, so we must not
|
||||
* maybe we still have events in the spec list, or there are
|
||||
* some tasks left pending in the run_queue, so we must not
|
||||
* wait in epoll() otherwise we will delay their delivery by
|
||||
* the next timeout.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user