pua_dialoginfo: fix early state lifetime and clean up dangling early branches#3915
Merged
bogdan-iancu merged 1 commit intoJun 11, 2026
Merged
Conversation
…branches The expire for "trying"/"early" publications was computed from the remainder of the branch fr_timer, which is updated only AFTER the TMCB_RESPONSE_IN callback runs. A provisional reply arriving close to the timer expiration produced a near-zero lifetime, so the published state expired before the dialog module could update it, leaving orphan presence records. Use DEFAULT_CREATED_LIFETIME instead. As the longer lifetime may leave a dangling "early" state when a branch never receives a final negative reply (e.g. UAS goes silent after ringing), also hook on TMCB_ON_FAILURE and publish "terminated" for any branch from the last set of active branches which entered early state but never failed. Closes OpenSIPS#3802
Member
|
Thank you @NormB |
bogdan-iancu
added a commit
that referenced
this pull request
Jun 11, 2026
pua_dialoginfo: fix early state lifetime and clean up dangling early branches (cherry picked from commit 6755c14)
bogdan-iancu
added a commit
that referenced
this pull request
Jun 11, 2026
pua_dialoginfo: fix early state lifetime and clean up dangling early branches (cherry picked from commit 6755c14)
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3802, as requested in #3802 (comment).
This is the patch from the Feb 13 comment, tested by @andrewyager in pre-prod/prod against 3.4, rebased onto current master with the following adjustments:
t->first_branch..t->nr_of_outgoings) instead of allMAX_BRANCHES, per @bogdan-iancu's review comment.BRANCH_BM_TST_IDX/BRANCH_BM_SET_IDXinstead of rawlong longshifts) and toTM_BRANCH().bitmask_failedfor each branch it terminates, so a late-arriving negative reply on that branch cannot publish a duplicate "terminated".DLG_PUB_A/DLG_PUB_Bpublishing flags, consistent with the rest of the callback.TMCB_ON_FAILUREalready runs under the transaction's reply lock (viat_should_relay_response()->run_failure_handlers()), so the bitmask test/set is safe and re-takingt->reply_mutexwould deadlock.Summary of the fix
DEFAULT_CREATED_LIFETIMEfor the published state lifetime instead offr_timer.time_out - get_ticks()— the fr_timer is updated only afterTMCB_RESPONSE_INruns, so a provisional reply arriving close to the timer expiration produced a near-zero lifetime and orphaned presence records.TMCB_ON_FAILUREand publish "terminated" for any branch that entered "early" state but never received a final negative reply, so the longer lifetime cannot leave a dangling "early" state when the UAS goes silent after ringing.Re-validation on current master
Re-ran the scenarios from the issue against this rebased patch (master @ 4ddb8f0, loopback,
fr_timeout=10,fr_inv_timeout=15):expires=3600(previously 7s remainder); 200 OK then publishes confirmed with the dialog lifetime — original bug fixed.fr_inv_timeout, "terminated" withexpires=0is published for both directions before the failure route runs, and pua deletes the record from its hash table — no dangling early state.