[Home]

Summary:ASTERISK-29201: Crash occurs when Transfer and execute Hangup before the Transfer result
Reporter:Dan Cropp (daninmadison)Labels:
Date Opened:2020-12-07 14:18:37.000-0600Date Closed:2021-01-06 18:20:38.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:16.15.0 17.9.0 18.1.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:Ubuntu 16 and 18Attachments:( 0) core-brief.txt
( 1) core-full.txt
( 2) core-info.txt
( 3) core-locks.txt
( 4) core-thread1.txt
( 5) messages
Description:In the code I submitted for ASTERISK-26968 there is a bug which can cause a crash.  
We perform a transfer using AMI.
The transferred call is not answered and we don't receive a transfer result, we then issue a Hangup using AMI.  The call terminates, but the problem is the SUBSCRIPTION/NOTIFY is trying to access session memory after it has been freed by the hangup.

What's missing is correct session reference counting to make sure it's not released until after we no longer need it.

We have a fix for this issue which I would like to submit.  I will need to refresh on the steps to make a submission.
Comments:By: Asterisk Team (asteriskteam) 2020-12-07 14:18:39.468-0600

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: Kevin Harwell (kharwell) 2020-12-07 15:11:41.267-0600

Here's the gerrit wiki link that might help in refreshing things :-)

https://wiki.asterisk.org/wiki/display/AST/Gerrit+Usage

By: Kevin Harwell (kharwell) 2020-12-07 15:14:30.175-0600

Also folks might be interested in what the backtrace [1] looks like if you can attach.

[1] https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

Thanks!

By: Dan Cropp (daninmadison) 2020-12-07 16:09:14.554-0600

Updated the description to more accurately reflect the issue.

By: Dan Cropp (daninmadison) 2020-12-08 13:54:45.256-0600

Core dump files and messages (debug set to 4).

The call sequence is as follows (10.9.9.151 is the system that crashes):

Incoming SIP call to extension 8000@10.9.9.151 at 18:00:03
Dialplan routes call to 8000@10.9.9.150 at 18:00:03

Call redirected (via manager interface) to extension 6000.

Extension 6000 executes Transfer(PJSIP/sip:8001@10.9.9.150) which sends a REFER to 10.9.9.150 at 18:00:14

10.9.9.150 sends a BYE to disconnect the call at 18:01:14

The sip session is destroyed at 18:01:46

The transferred call is hung up, resulting in a NOTIFY from 10.9.9.150 at 18:01:54.  Since the SIP session has been destroyed and its memory released, attempting to access the channel results in a crash.

By: Dan Cropp (daninmadison) 2020-12-08 13:56:58.434-0600

I need to submit a new modification.  We believe there was still a potential timing issue that could occur.
We will test this modification and submit the change.