Module: kamailio Branch: master Commit: b7e8c43968866135b18555993c524ef096abf1f3 URL: https://github.com/kamailio/kamailio/commit/b7e8c43968866135b18555993c524ef096abf1f3
Author: Stefan Mititelu <[email protected]> Committer: Henning Westerholt <[email protected]> Date: 2025-09-25T11:16:15+02:00 core: try fix timer list only in case of issues --- Modified: src/core/timer.c --- Diff: https://github.com/kamailio/kamailio/commit/b7e8c43968866135b18555993c524ef096abf1f3.diff Patch: https://github.com/kamailio/kamailio/commit/b7e8c43968866135b18555993c524ef096abf1f3.patch --- diff --git a/src/core/timer.c b/src/core/timer.c index 615caa1edf8..7a82d71b34e 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -892,18 +892,36 @@ inline static void timer_list_expire(ticks_t t, struct timer_head *h first = h->next; #endif - // check if timer circular double linked list has broken links - // try to recover if so, otherwise abort execution LM_DBG("ksr_timer_sanity_check = %ld\n", ksr_timer_sanity_check); - if(ksr_timer_sanity_check != 0 && !timer_list_sanity_check(h)) { - abort(); - } - /*LM_DBG("@ ticks = %lu, list =%p\n", (unsigned long) *ticks, h); */ while(h->next != (struct timer_ln *)h) { - tl = h->next; + if(ksr_timer_sanity_check != 0) { + if(h->next == NULL || h->prev == NULL) { + // check if timer circular double linked list has broken links + // try to recover if so, otherwise abort execution + if(!timer_list_sanity_check(h)) { + LM_CRIT("timer_list_expire: h=%p {%p, %p}\n", h, h->next, + h->prev); + abort(); + } + } + + tl = h->next; + if(tl->next == NULL || tl->prev == NULL) { + // check if timer circular double linked list has broken links + // try to recover if so, otherwise abort execution + if(!timer_list_sanity_check(h)) { + LM_CRIT("timer_list_expire: tl=%p, h=%p {%p, %p}\n", tl, h, + h->next, h->prev); + abort(); + } + } + } else { + tl = h->next; + } + #ifdef TIMER_DEBUG if(tl == 0) { LM_CRIT("timer_list_expire: tl=%p, h=%p {%p, %p}\n", tl, h, h->next, _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
