<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 08.01.21 19:04, Duarte Rocha wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAJJHZg7RuP8zdGHMYdDgcLgcLDhh0FzGxrTu7XaLE3Uo9b72Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Thanks for the help.</div>
<div><br>
</div>
I'm using db_mode 1 - Write-Through scheme. As far as i
understand it uses database and cache correct? Is that the
difference from mode 3?</div>
</blockquote>
Yes, db_mode 1 is different than db_mode 3, the later does no
caching.<br>
<blockquote type="cite"
cite="mid:CAAJJHZg7RuP8zdGHMYdDgcLgcLDhh0FzGxrTu7XaLE3Uo9b72Q@mail.gmail.com">
<div dir="ltr">
<div><br>
</div>
<div>I'll do some testing with the usrloc's behaviour and i'll
let you know.</div>
</div>
</blockquote>
<p><br>
</p>
<p>If there is no external application blocking the database, look
at latency core parameters, it may help to figure out if kamailio
does a query that is slow.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<blockquote type="cite"
cite="mid:CAAJJHZg7RuP8zdGHMYdDgcLgcLDhh0FzGxrTu7XaLE3Uo9b72Q@mail.gmail.com">
<div dir="ltr">
<div><br>
</div>
<div>Cheers</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Daniel-Constantin Mierla <<a
href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>
escreveu no dia sexta, 8/01/2021 à(s) 17:47:<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>if there is no external application that accesses the
location table and you have many records, try to tune the
behaviour of usrloc module, by setting timer procs and
interval to different values. Also, if you use
database-only mode with a lot of active users, you can
also consider partitioning users on different tables, so
you can have rules like users with id starting a-m go to
location1 and n-z go to location2.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div>On 08.01.21 18:29, Duarte Rocha wrote:<br>
</div>
<blockquote type="cite">
<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"
target="_blank" moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">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" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank" moz-do-not-send="true">https://www.paypal.me/dcmierla</a></pre>
</div>
</blockquote>
</div>
</blockquote>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank" moz-do-not-send="true">https://www.paypal.me/dcmierla</a></pre>
</div>
</blockquote>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
</body>
</html>