Skip to content

nta: don't abort on an outgoing transaction re-queued without progress#333

Open
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-57-timer-bf-antispin
Open

nta: don't abort on an outgoing transaction re-queued without progress#333
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-57-timer-bf-antispin

Conversation

@garacil

@garacil garacil commented Jul 5, 2026

Copy link
Copy Markdown

outgoing_timer_bf() asserted that, after handling a B/F timeout, the transaction had either left the queue head or had its timeout advanced past now.

outgoing_timeout() can re-queue the same orq at the head of the same queue (via outgoing_try_another() → resolve / send / outgoing_trying()). Normally that re-queue sets a future timeout, but under load the same orq can be back at the head with a non-advanced timeout, and the assert() then abort()s the whole process (see #57).

This replaces the assert with an anti-spin guard: if the same orq is back at the head with a non-advanced timeout, it is logged and this timer pass stops. agent_timer reschedules to now + 1 while a head timeout is still due, so the transaction is retried on the next timer turn instead of spinning here — or aborting. The normal path is unchanged.

Fixes #57.

outgoing_timer_bf() asserted that, after handling a B/F timeout, the
transaction had either left the queue head or had its timeout advanced past
now. outgoing_timeout() can re-queue the same orq at the head (via
outgoing_try_another -> resolve/send/trying). Normally that re-queue sets a
future timeout, but under load the same orq can be back at the head with a
non-advanced timeout, and the assert then abort()s the whole process.

Replace the assert with an anti-spin guard: if the same orq is back at the
head with a non-advanced timeout, log it and stop this timer pass. The agent
timer reschedules to now+1 while a head timeout is still due, so the
transaction is retried on the next timer turn instead of spinning here or
aborting.

Fixes freeswitch#57.
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.

Why add assert for outgoing_timer_bf

1 participant