<!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">
    Hi Torge,<br>
    <br>
    I think it's better to send your mail to the mailinglist, then more
    people can have a look at your problem.<br>
    <br>
    I'm not really familiar with the kamailio source code. Just started
    using Kamailio about 8 months back. I came across a problem with
    requesting information from a postgresql database and made a patch
    which 'works for me'. I'm not using siptrace.<br>
    <br>
    Maybe you can supply more logging (through the mailinglist) of the
    database communication. The mysql error "Duplicate entry '96193' for
    key 'PRIMARY'" is a bit weird. As I said, I don't know and don't use
    the msyql driver in kamailio, but normally I would expect that mysql
    itself would take care of generating a primary key for the record.<br>
    <br>
    So maybe your problem is in the mysql server and not kamailio.<br>
    Maybe this page can help you:<br>
<a class="moz-txt-link-freetext" href="http://www.softwareprojects.com/resources/programming/t-how-to-fix-mysql-duplicate-entry-for-key-primary-o-1844.html">http://www.softwareprojects.com/resources/programming/t-how-to-fix-mysql-duplicate-entry-for-key-primary-o-1844.html</a><br>
    <br>
    With kind regards,<br>
    Robert Verspuy<br>
    <br>
    <br>
    <br>
    Op 05-05-11 13:19, Dr. Torge Szczepanek schreef:
    <blockquote
      cite="mid:3FAB9611-6243-4B79-B56D-64169E654417@cygnusnetworks.de"
      type="cite">Hi!
      <div><br>
      </div>
      <div>First of all thanks for all of your work. I really appreciate
        and I am glad that there is such a nice Opensource SIP Proxy
        available.</div>
      <div><br>
      </div>
      <div>In a current project I am heavily relying on SIP Traces
        stored to a database and other sqlops, dialplan operations using
        database connections.</div>
      <div><br>
      </div>
      <div>It seems that there is a race condition with SQL Databases
        (Postgres and also MySQL) due to thread insafety as described
        in:</div>
      <div><br>
      </div>
      <div><a moz-do-not-send="true"
href="http://lists.sip-router.org/pipermail/sr-dev/2010-October/009689.html">http://lists.sip-router.org/pipermail/sr-dev/2010-October/009689.html</a></div>
      <div><br>
      </div>
      <div>This is causing multiple errors. I guess that the following
        error is also caused by this race condition (thread safety):</div>
      <div><br>
      </div>
      <div>
        <div>/usr/sbin/kamailio[5646]: ERROR: &lt;core&gt;
          [db_query.c:179]: error while submitting query</div>
        <div>/usr/sbin/kamailio[5646]: ERROR: siptrace [siptrace.c:532]:
          error storing trace</div>
        <div>/usr/sbin/kamailio[5646]: ERROR: db_mysql [km_dbase.c:120]:
          driver error on query: Duplicate entry '96193' for key
          'PRIMARY'</div>
      </div>
      <div><br>
      </div>
      <div>My Kamailo Version (3.1.2) is reporting duplicate database
        URLs using a warning:</div>
      <div><br>
      </div>
      <div>
        <div>/usr/sbin/kamailio[5613]: WARNING: &lt;core&gt;
          [db_id.c:281]: identical DB URLs, but different DB connection
          pid [5613/5562]</div>
        <div>/usr/sbin/kamailio[5618]: WARNING: &lt;core&gt;
          [db_id.c:281]: identical DB URLs, but different DB connection
          pid [5618/5562]</div>
        <div>/usr/sbin/kamailio[5616]: WARNING: &lt;core&gt;
          [db_id.c:281]: identical DB URLs, but different DB connection
          pid [5616/5562]</div>
        <div>/usr/sbin/kamailio[5600]: WARNING: &lt;core&gt;
          [db_id.c:281]: identical DB URLs, but different DB connection
          pid [5600/5562]</div>
        <div>/usr/sbin/kamailio[5617]: WARNING: &lt;core&gt;
          [db_id.c:281]: identical DB URLs, but different DB connection
          pid [5617/5562]</div>
      </div>
      <div><br>
      </div>
      <div>Git commit 9fb37a55e0b97a98b7d2d104a7692f18cb3f7df6 is
        turning this into a debug message, which I think is a bad idea
        if the thread insafety still exists.</div>
      <div><br>
      </div>
      <div>As far as I know every thread should use its own database
        handle, at least when using the MySQL API.</div>
      <div><br>
      </div>
      <div>Is there a way to handle this correctly? Can you give me any
        clues on which approach to take here? Since I need a solution
        for this I would like to &nbsp;fix this issue at least for myself and
        of course giving the change back.</div>
      <div><br>
      </div>
      <div>Greetings Torge</div>
      <div>
        <div>
          <div style="font-family: Helvetica; font-size: 12px;">
            <div style="word-wrap: break-word;">
              <div style="word-wrap: break-word;">
                <div style="word-wrap: break-word;">
                  <div><font class="Apple-style-span" face="Monaco"
                      size="2">--</font></div>
                  <div><font class="Apple-style-span" face="Monaco"
                      size="2">Dr. Torge Szczepanek</font></div>
                  <div><font class="Apple-style-span" face="Monaco"
                      size="2"><br class="webkit-block-placeholder">
                    </font></div>
                  <div><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">Cygnus
                      Networks GmbH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tel:
                      &nbsp;&nbsp;+49-228-9090987-0</span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><br>
                    </span><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">Adenauerallee
                      73 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fax:
                      &nbsp;&nbsp;+49-228-9090987-70</span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><br>
                    </span><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">D-53113
                      Bonn &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMail:&nbsp;</span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><a
                        moz-do-not-send="true"
                        href="mailto:info@cygnusnetworks.de">info@cygnusnetworks.de</a></span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><br>
                    </span><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">Amtsgericht
                      Bonn, HRB 15928 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SIP: &nbsp;&nbsp;</span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><a
                        moz-do-not-send="true"
                        href="mailto:info@cygnusnetworks.de">info@cygnusnetworks.de</a></span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><br>
                    </span><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">Geschaeftsfuehrer
                      Dr. Torge Szczepanek &nbsp;&nbsp;&nbsp;&nbsp;</span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><a
                        moz-do-not-send="true"
                        href="http://www.cygnusnetworks.de/">http://www.cygnusnetworks.de/</a></span><span
                      class="Apple-style-span" style="font-family:
                      Monaco; font-size: 10px;"><br>
                    </span><span class="Apple-style-span"
                      style="font-family: Monaco; font-size: 10px;">Steuernummer
                      205/5710/1347 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USt-ID DE258507007</span></div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <b>Exa-Omicron</b><br>
      Patroonsweg 10<br>
      3892 DB Zeewolde<br>
      Tel.: 088-OMICRON (66 427 66)<br>
      <a class="moz-txt-link-freetext" href="http://www.exa-omicron.nl">http://www.exa-omicron.nl</a></div>
  </body>
</html>