[Asterisk-code-review] res_pjsip_session: Added channel hangup check (asterisk[master])

sungtae kim asteriskteam at digium.com
Tue Feb 18 11:25:16 CST 2020


sungtae kim has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/13806 )

Change subject: res_pjsip_session: Added channel hangup check
......................................................................


Patch Set 2:

(1 comment)

Hi Joshua,

Thank you for your replying. I have added comment to here. Could you please check it?

Thanks.

https://gerrit.asterisk.org/c/asterisk/+/13806/2/res/res_pjsip_session.c 
File res/res_pjsip_session.c:

https://gerrit.asterisk.org/c/asterisk/+/13806/2/res/res_pjsip_session.c@1572 
PS2, Line 1572: 	if (ast_check_hangup(session->channel) || (media_state && (!media_state->topology || !generate_new_sdp))) {
> Would this not still have a race condition whereby the channel is marked as hung up after this check […]
The race-condition is happening under the hood(Actually pjproject).
Because the session's negotiator is not thread-safe, this problem is happening.

And also, this is happening when the Asterisk is trying to terminating the session within invite_terminated().
Because of the Asterisk is executing all the delayed_requests while its terminating without any condition check, it just executing the delayed tasks including the session_refreshing.

But the doing refreshing(re-invite) task requires access to the session's negotiator directly which makes race-condition inside of the pjproject, which makes things go wrong.

So, by adding the ast_channel_hangup() here, we can avoid to access to empty negotiator.
And we can make sure this is always true, because of the invite_terminated() is happening after ast_queue_hangup() has called.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13806
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ifa864e0e125b1a7ed2f3abd4164187e1dddc56da
Gerrit-Change-Number: 13806
Gerrit-PatchSet: 2
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Tue, 18 Feb 2020 17:25:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200218/a80fbd4c/attachment.html>


More information about the asterisk-code-review mailing list