<p>If the transaction being removed is the first item in the list<br>
of transactions then we need to update the pointer to the head<br>
of the list so it does not have a stale reference.</p>

<p>This is an attempt to fix the tsilo crashes we've been seeing. The crashes occur in ts_onreply while iterating over the transactions to remove the transaction for the TMCB_DESTROY callback. One of the transaction pointers is not a valid shared memory address and the process crashes.</p>

<p>This crash results in the main kamailio process getting a SIGCHILD signal and it tries to shut down. This reaches code to free the transactions and it crashes in free_ts_urecord while trying to free the same transaction.</p>

<p>Inspecting code I can't tell how remove_ts_transaction resets urecord->transactions to be the head of the list of the first transaction to be removed is the first item in the list. This would leave a dangling pointer there and seems likely to be the cause of the crash.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/311'>https://github.com/kamailio/kamailio/pull/311</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Change remove_ts_transaction so it updates head pointer of list</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/311/files#diff-0">modules/tsilo/ts_hash.c</a>
    (4)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/311.patch'>https://github.com/kamailio/kamailio/pull/311.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/311.diff'>https://github.com/kamailio/kamailio/pull/311.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/pull/311">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36Zbvj_uqlibKpRmpMlcacnG1Boso5ks5otLWbgaJpZM4F1UXH.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/311"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>