<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">after much attempting of getting stop retransmission timers working<br>safely it seems like something immediately re-arms it. I have come<br>to the conclusion that the only safe fix possible is my original<br>one (where group lock is acquired while modifying the tdata).</p><p style="white-space: pre-wrap; word-wrap: break-word;">Let me know what you think</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Your original patch did locking but that only protected access to the tdata while in pjsip_inv_answer(). I think it likely introduced locking inversions that can cause other deadlock scenarios. It also did not provide protection from Asterisk adding headers to the tdata since Asterisk believes that it is the only thread that knows about it.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Canceling the retransmission timer was a good idea but canceling will only work if the callback is not already in progress as that callback could restart the timer and it has to access the tdata struct.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I really think the only safe thing left is to clone the tdata before pjsip_inv_answer() passes it back to the caller.</p><p><a href="https://gerrit.asterisk.org/9477">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/9477">change 9477</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/9477"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Ic381004a3a212fe1d8eca0e707fe09dba4a6ab4e </div>
<div style="display:none"> Gerrit-Change-Number: 9477 </div>
<div style="display:none"> Gerrit-PatchSet: 8 </div>
<div style="display:none"> Gerrit-Owner: Torrey Searle <tsearle@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Torrey Searle <tsearle@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 26 Jul 2018 15:59:45 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>