<p>George Joseph <strong>uploaded patch set #2</strong> to this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15494">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_refer: Refactor progress locking and serialization<br><br>Although refer_progress_notify() always runs in the progress<br>serializer, the pjproject evsub module itself can cause the<br>subscription to be destroyed which then triggers<br>refer_progress_on_evsub_state() to clean it up.  In this case, it's<br>possible that this function could get the subscription pulled out<br>from under it while it's trying to use it.<br><br>At one point we tried to have refer_progress_on_evsub_state()<br>push the cleanup to the serializer and wait for it's return<br>before returning to pjproject but since pjproject calls its state<br>callbacks with the dialog locked, this required us to unlock the<br>dialog while waiting for the serialized cleanup, then lock it<br>again before returning to pjproject. There were also still some<br>cases where other callers of refer_progress_notify() weren't<br>using the serializer and crashes were resulting.<br><br>Although all callers of refer_progress_notify() now use the<br>progress serializer, we decided to simplify the locking so we<br>didn't have to unlock and relock the dialog in<br>refer_progress_on_evsub_state().<br><br>Now, refer_progress_notify() holds the dialog lock for all its<br>work rather than just when calling pjsip_evsub_set_mod_data() to<br>clear the module data.  Since pjproject also holds the dialog<br>lock while calling refer_progress_on_evsub_state(), there should<br>be no more chances for the subscription to be cleaned up while<br>still being used to send NOTIFYs.<br><br>ASTERISK-29313<br><br>Change-Id: I97a8bb01771a3c85345649b8124507f7622a8480<br>---<br>M res/res_pjsip_refer.c<br>1 file changed, 49 insertions(+), 35 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/15494/2</pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15494">change 15494</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/+/15494"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I97a8bb01771a3c85345649b8124507f7622a8480 </div>
<div style="display:none"> Gerrit-Change-Number: 15494 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.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-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>