Skip to content

su_timer: skip an expired timer with no callback instead of aborting#334

Open
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-251-timer-null-callback
Open

su_timer: skip an expired timer with no callback instead of aborting#334
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-251-timer-null-callback

Conversation

@garacil

@garacil garacil commented Jul 5, 2026

Copy link
Copy Markdown

su_timer_expire() asserted that a set, expired timer always has a wakeup callback. Under load a stale/racy or invalidly-set timer can reach expiry with a NULL callback (e.g. a concurrent su_timer_reset()); there is nothing valid to call, but assert(f) abort()s the whole process (#251, #255).

This skips such a timer gracefully: it is logged, marked not-running (sut_running = reset, sut_arg = NULL) and the loop continues with the next timer, rather than aborting. Timers that do have a callback are unaffected, and the skipped timer is not counted as fired.

Fixes #251, #255.

su_timer_expire() asserted that a set, expired timer always has a wakeup
callback. Under load a stale/racy or invalidly-set timer can reach expiry with
a NULL callback (e.g. a concurrent su_timer_reset); there is nothing valid to
call, but assert(f) abort()s the whole process.

Skip such a timer gracefully: log it, mark it not-running (sut_running = reset,
sut_arg = NULL) and continue with the next timer, rather than aborting. Timers
that do have a callback are unaffected.

Fixes freeswitch#251, freeswitch#255.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

During extra load on server meet with timer assertion

1 participant