2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

2254. [bug] timer.c:dispatch() failed to lock timer->lock

when reading timer->idle allowing it to see
                        intermediate values as timer->idle was reset by
                        isc_timer_touch(). [RT #17243]
This commit is contained in:
Mark Andrews
2007-10-24 00:57:23 +00:00
parent 1aae495985
commit f183f4c0cd
2 changed files with 33 additions and 17 deletions

View File

@@ -1,3 +1,8 @@
2254. [bug] timer.c:dispatch() failed to lock timer->lock
when reading timer->idle allowing it to see
intermediate values as timer->idle was reset by
isc_timer_touch(). [RT #17243]
--- 9.5.0a7 released --- --- 9.5.0a7 released ---
2253. [func] "max-cache-size" defaults to 32M. 2253. [func] "max-cache-size" defaults to 32M.

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: timer.c,v 1.80 2007/06/19 23:47:17 tbox Exp $ */ /* $Id: timer.c,v 1.81 2007/10/24 00:57:23 marka Exp $ */
/*! \file */ /*! \file */
@@ -581,6 +581,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
isc_eventtype_t type = 0; isc_eventtype_t type = 0;
isc_timer_t *timer; isc_timer_t *timer;
isc_result_t result; isc_result_t result;
isc_boolean_t idle;
/*! /*!
* The caller must be holding the manager lock. * The caller must be holding the manager lock.
@@ -612,15 +613,24 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
type = ISC_TIMEREVENT_LIFE; type = ISC_TIMEREVENT_LIFE;
post_event = ISC_TRUE; post_event = ISC_TRUE;
need_schedule = ISC_FALSE; need_schedule = ISC_FALSE;
} else if (!isc_time_isepoch(&timer->idle) && } else {
idle = ISC_FALSE;
LOCK(&timer->lock);
if (!isc_time_isepoch(&timer->idle) &&
isc_time_compare(now, isc_time_compare(now,
&timer->idle) >= 0) { &timer->idle) >= 0) {
idle = ISC_TRUE;
}
UNLOCK(&timer->lock);
if (idle) {
type = ISC_TIMEREVENT_IDLE; type = ISC_TIMEREVENT_IDLE;
post_event = ISC_TRUE; post_event = ISC_TRUE;
need_schedule = ISC_FALSE; need_schedule = ISC_FALSE;
} else { } else {
/* /*
* Idle timer has been touched; reschedule. * Idle timer has been touched;
* reschedule.
*/ */
XTRACEID(isc_msgcat_get(isc_msgcat, XTRACEID(isc_msgcat_get(isc_msgcat,
ISC_MSGSET_TIMER, ISC_MSGSET_TIMER,
@@ -630,6 +640,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
post_event = ISC_FALSE; post_event = ISC_FALSE;
need_schedule = ISC_TRUE; need_schedule = ISC_TRUE;
} }
}
if (post_event) { if (post_event) {
XTRACEID(isc_msgcat_get(isc_msgcat, XTRACEID(isc_msgcat_get(isc_msgcat,