<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <tt>Hi Eric,<br>
      <br>
      Thank you for your patch and first of all for spotting the problem
      - a real tricky one.<br>
      <br>
      But as Vlad explained you on IRC, the patch has a problem as it
      breaks the atomic "test and set" for "transaction lookup and
      creation".<br>
      <br>
      Also, the callback cannot be moved after the transaction creation
      (actually cloning the request in transaction) as several module
      rely on this to do last minute parsing, parsing to be cloned in
      transaction.<br>
      <br>
      What I would find as a clean solution is to split the callback for
      TMCB_REQUEST_IN in TMCB_REQUEST_IN (as it is, under lock, for
      special cases) and TMCB_REQUEST_POST_IN to be called after
      transaction is created, outside the lock, for modules interested
      just in the event "new transaction"<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <br>
    On 02/28/2013 07:33 PM, Eric Tamme wrote:
    <blockquote
cite="mid:CAD31pt-EBySwHuMKP4prw7hBybXO4814JGJbzzxK8SA-f1NDBA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>We found that initial request callbacks are called with
              a lock on the tm hash row so any callback that generates a
              new transaction, in our example the pua module, can
              generate a hash for the new transaction with the same key
              as the locked row thus creating a deadlock.<br>
              <br>
            </div>
            We modified the code to create a lock on the cell when
            t_newtran() calls new_t and release the hash lock within
            new_t so that the callbacks are called with a cell lock, not
            a row lock.&nbsp; This looks l<br>
            <br>
          </div>
          Please review the attached patch.&nbsp; The patch was made on a
          1.6.4 code base.&nbsp; Let me know if you have any thoughts or
          concerns.<br>
          <br>
        </div>
        -Eric<br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
    </blockquote>
  </body>
</html>