<div dir="ltr">Hello Daniel, <div><br></div><div>I have Kamailio on an HA setup. One machine has the active Kamailio and if something happens, the IP jumps to the another machine where there is a Kamailio running. Both Kamailio's share the same remote database. Could the reason be both Kamailio's trying to remove expired contacts from the location table at the same time? </div><div><br></div><div>Cheers,</div><div>Duarte</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> escreveu no dia quinta, 7/01/2021 à(s) 19:28:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hello,</p>
    <p>is there any other application that accesses the location table?</p>
    <p>That error message usually appears when the update of the record
      cannot be made because it is locked for long time by something
      else.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div>On 07.01.21 18:23, Duarte Rocha wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi all, <br>
        <br>
        I've made a post last month regarding losing MySQL connections
         - <a href="https://lists.kamailio.org/pipermail/sr-users/2020-December/111389.html" target="_blank">https://lists.kamailio.org/pipermail/sr-users/2020-December/111389.html</a><br>
        <br>
        At the time I thought connections were dying as a consequence of
        low activity and traffic on the proxy. Meanwhile, I've migrated
        a great number of equipments to the proxy with Registers being
        refreshed every 10minutes and the problem still persists.<br>
        <br>
        In order to try to fix this i've added timeout_interval and
        ping_interval from the db_mysql module. My SQL client on the
        Kamailio machine is mysql-community-client  5.6.50-2.el7. It
        writes and reads in a remote InnoDB database.<br>
        <br>
        This are the logs i get from Kamailio when the problem appears :
        <br>
        <br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} db_mysql
        [km_dbase.c:123]: db_mysql_submit_query(): driver error on
        query: Lock wait timeout exceeded; try restarting transaction
        (1205)<br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} <core>
        [db_query.c:348]: db_do_update(): error while submitting query<br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} usrloc
        [ucontact.c:1147]: db_update_ucontact_ruid(): updating database
        failed<br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} usrloc
        [ucontact.c:1663]: update_contact_db(): failed to update
        database<br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} registrar
        [save.c:784]: update_contacts(): failed to update contact<br>
        Jan  7 09:43:27 sbc_bbt01_active
        /usr/local/kamailio-5.4/sbin/kamailio[21735]: ERROR: {1 27880
        REGISTER e5f8f7bc-cbb2-40b3-9037-edacd6276a2b} sl
        [sl_funcs.c:414]: sl_reply_error(): stateless error reply used:
        I'm terribly sorry, server error occurred (1/SL)<br>
        <br>
        <br>
        Originally I had usrloc db_mode on mode 3 - DB-Only Scheme. In
        order to try to mitigate the issue I changed it to mode 1 -
        Write-Through scheme but even then I get the same log errors and
        an "500" error is still sent to the client. I chose this mode
        since, as far as I can understand it applies changes directly to
        DB but also uses cache. Please correct me if i'm wrong on that.<br>
        <br>
        Has this issue happened with anyone before? Is there a way to
        mitigate this issue? My only constraint is that I need the
        database to be always updated since I have an HA setup, and as
        such, I can't use cache only methods.<br>
        <br>
        Best Regards,<br>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
  </div>

</blockquote></div>