<p style="white-space: pre-wrap; word-wrap: break-word;">Hi Joshua,</p><p style="white-space: pre-wrap; word-wrap: break-word;">Thank you for your replying. I have added comment to here. Could you please check it?</p><p style="white-space: pre-wrap; word-wrap: break-word;">Thanks.<br></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13806">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13806/2/res/res_pjsip_session.c">File res/res_pjsip_session.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/13806/2/res/res_pjsip_session.c@1572">Patch Set #2, Line 1572:</a> <code style="font-family:monospace,monospace"> if (ast_check_hangup(session->channel) || (media_state && (!media_state->topology || !generate_new_sdp))) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Would this not still have a race condition whereby the channel is marked as hung up after this check […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">The race-condition is happening under the hood(Actually pjproject).<br>Because the session's negotiator is not thread-safe, this problem is happening.</p><p style="white-space: pre-wrap; word-wrap: break-word;">And also, this is happening when the Asterisk is trying to terminating the session within invite_terminated().<br>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.</p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So, by adding the ast_channel_hangup() here, we can avoid to access to empty negotiator.<br>And we can make sure this is always true, because of the invite_terminated() is happening after ast_queue_hangup() has called.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13806">change 13806</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13806"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifa864e0e125b1a7ed2f3abd4164187e1dddc56da </div>
<div style="display:none"> Gerrit-Change-Number: 13806 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 18 Feb 2020 17:25:16 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>