Make scheduling loop detector less sensitive

It could be triggered by delayed name resolving as it adds multiple new
timeouts which can be called in the same dispatching if the DNS responses
are slower than initial delay and sampling separation.

Compare number of dispatched events also with current number of
timeouts.
This commit is contained in:
Miroslav Lichvar 2011-08-26 16:52:00 +02:00
parent 1d2a0856b4
commit f1a0cacc5a

11
sched.c
View file

@ -466,11 +466,12 @@ dispatch_timeouts(struct timeval *now) {
++n_done; ++n_done;
/* If more timeouts were handled than there were in the timer queue on /* If more timeouts were handled than there were in the timer queue on
start, assume some code is scheduling timeouts with negative delays and start and there are now, assume some code is scheduling timeouts with
abort. Make the actual limit higher in case the machine is temporarily negative delays and abort. Make the actual limit higher in case the
overloaded and dispatching the handlers takes more time than was delay machine is temporarily overloaded and dispatching the handlers takes
of a scheduled timeout. */ more time than was delay of a scheduled timeout. */
if (n_done > n_entries_on_start * 4) { if (n_done > n_timer_queue_entries * 4 &&
n_done > n_entries_on_start * 4) {
LOG_FATAL(LOGF_Scheduler, "Possible infinite loop in scheduling"); LOG_FATAL(LOGF_Scheduler, "Possible infinite loop in scheduling");
} }
} }