[Home]

Summary:ASTERISK-29466: pjsip: Asserts (when built in developer mode) when the call hangs up a few seconds before it would send UPDATE
Reporter:Sunny Narendra (sunnyn)Labels:patch pjsip
Date Opened:2021-06-07 05:51:37Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:pjproject/pjsip
Versions:18.4.0 Frequency of
Occurrence
Frequent
Related
Issues:
is duplicated byASTERISK-30154 pjsip: assertion failure
Environment:Attachments:( 0) 0011-Fixed-race-condition-between-session-timer-and-call-disconnection.patch
( 1) fix-0011-sip_inv_patch.diff
Description:To reproduce the crash:
* Make Asterisk Session-Expires timer to 120 instead of using the default 1800 (timers_sess_expires=120). With this change the Asterisk will send the UPDATE every 60s.

The call scenario:
* A calls B
* B answers the call
* B hangs up after 0:57

Core dump:
{code:java}
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f0c75ec242a in __GI_abort () at abort.c:89
#2  0x00007f0c75eb9e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7f0c78d15b70 "inv->state < PJSIP_INV_STATE_DISCONNECTED", file=file@entry=0x7f0c78d150af "../src/pjsip-ua/sip_inv.c", line=line@entry=3064,
   function=function@entry=0x7f0c78d162b0 <__PRETTY_FUNCTION__.8486> "pjsip_inv_update") at assert.c:92
#3  0x00007f0c75eb9f12 in __GI___assert_fail (assertion=0x7f0c78d15b70 "inv->state < PJSIP_INV_STATE_DISCONNECTED", file=0x7f0c78d150af "../src/pjsip-ua/sip_inv.c", line=3064, function=0x7f0c78d162b0 <__PRETTY_FUNCTION__.8486> "pjsip_inv_update") at assert.c:101
#4  0x00007f0c78c09811 in pjsip_inv_update (inv=0x7f0c68023c68, new_contact=0x0, offer=0x0, p_tdata=0x7f0c245f9ce8) at ../src/pjsip-ua/sip_inv.c:3063
#5  0x00007f0c78c15680 in timer_cb (timer_heap=0x5597b71a04b0, entry=0x7f0c68023ed0) at ../src/pjsip-ua/sip_timer.c:398
#6  0x00007f0c78d0d487 in pj_timer_heap_poll (ht=0x5597b71a04b0, next_delay=0x7f0c245f9e10) at ../src/pj/timer.c:913
#7  0x00007f0c78c33f63 in pjsip_endpt_handle_events2 (endpt=0x5597b71a01c8, max_timeout=0x7f0c245f9e70, p_count=0x0) at ../src/pjsip/sip_endpoint.c:716
#8  0x00007f0c78c340ee in pjsip_endpt_handle_events (endpt=0x5597b71a01c8, max_timeout=0x7f0c245f9e70) at ../src/pjsip/sip_endpoint.c:777
#9  0x00007f0c2b2113e0 in monitor_thread_exec (endpt=0x0) at res_pjsip.c:5166
#10 0x00007f0c78cef7b2 in thread_main (param=0x5597b73cb708) at ../src/pj/os_core_unix.c:541
#11 0x00007f0c7736b4a4 in start_thread (arg=0x7f0c245fa700) at pthread_create.c:456
#12 0x00007f0c75f76d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
(gdb)
{code}
Following patch seems to fix the issue:

*edit:* inline patch removed
Comments:By: Asterisk Team (asteriskteam) 2021-06-07 05:51:38.191-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2021-06-07 06:02:40.381-0500

Are you building Asterisk in developer mode? In normal builds this should not trigger the assert and it would not crash.

By: Sunny Narendra (sunnyn) 2021-06-07 06:35:05.053-0500

Yes, we are building Asterisk in developer mode.

By: Kevin Harwell (kharwell) 2021-06-07 13:25:14.219-0500

[~sunnyn] Unfortunately we cannot accept inline patches. However, patches can be attached to an issue after [signing a license agreement|https://wiki.asterisk.org/wiki/display/AST/Digium+License+Agreement] if you have not already done so.

By: Sunny Narendra (sunnyn) 2021-06-07 16:10:03.833-0500

Patch attached.

By: Joshua C. Colp (jcolp) 2021-06-08 04:06:40.362-0500

If you have not signed a license agreement your patch will not be visible. If you have signed one then you have to wait until it is processed by legal before attaching a patch.

By: Sunny Narendra (sunnyn) 2021-06-08 04:19:17.519-0500

I have signed license agreement before creating this ticket.

By: Joshua C. Colp (jcolp) 2021-06-08 04:22:06.488-0500

It has not been accepted as of yet, you need to wait until then before the patch can be attached and seen.

By: Sunny Narendra (sunnyn) 2021-06-09 15:52:10.682-0500

License agreement has been accepted. Now I can see the patch attached

By: Kevin Harwell (kharwell) 2021-06-09 18:00:43.510-0500

[~sunnyn] This is essentially a pjproject problem, and patch for them. If you haven't already please open an issue with them on [their tracker|https://github.com/pjsip/pjproject/issues/] as well. Note, this is probably related to, or affects [pjproject issue 2443|https://github.com/pjsip/pjproject/issues/2443], so you might make mention of that too.

Once they verify the patch for inclusion in pjproject please comment back here, then it may be included in "pjproject bundled" for Asterisk.

Thanks!

By: Joshua Elson (joshelson) 2021-06-22 14:46:46.106-0500

So, if I'm reading this thread correctly, it seems like this patch did indeed resolve the issue:

https://github.com/pjsip/pjproject/issues/2443

Do we want to add this patch to the pjproject patches? If I'm looking at this right, this should also resolve ASTERISK-29286. Let me know, and I can get that all submitted if it'd be helpful.

By: Joshua C. Colp (jcolp) 2021-06-22 15:13:04.635-0500

The given patch is already in Asterisk. If you are referring to https://github.com/pjsip/pjproject/issues/2732 which is separate, that is not in Asterisk and has not been accepted by Teluu it looks like either.

By: Joshua Elson (joshelson) 2021-06-22 15:30:42.972-0500

I need to look at this a little more deeply, but these look to be very nearly identical patches. I can't imagine it would even be possible to apply both.

By: Sunny Narendra (sunnyn) 2021-06-24 02:52:31.279-0500

[~joshelson] the attached patch in this ticket is a change in the existing patch.

By: Joshua C. Colp (jcolp) 2021-06-24 08:18:33.181-0500

We'll give Teluu some more time to respond. If after another week or so they don't, we'll see about engaging them as well to try to help get eyes on things. Once that is done then a review can be done to include this.

By: Asterisk Team (asteriskteam) 2021-07-08 12:00:03.027-0500

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

By: Joshua C. Colp (jcolp) 2021-07-08 12:04:34.927-0500

Reopening since automation closed prematurely.

By: Stanislav Abramenkov (silentindark) 2023-04-06 03:37:29.415-0500

Teluu posted a patch for this:
https://github.com/pjsip/pjproject/pull/3494
Not merged to upstream yet.