<p>I looked at the docs for lib mysql client, haven't spotted any other hint for attempting to reconnect.</p>

<p>Is the next log message added by you?</p>

<pre><code>Dec  8 17:06:19 /usr/sbin/kamailio[31957]: WARNING: db_mysql [km_dbase.c:92]: db_mysql_submit_query(): mysql thread id changed due to reconnect on mysql_ping
</code></pre>

<p>It doesn't match in the source code. If you did some changes to db_mysql module, post here the diff.</p>

<p>Also, what is the module that triggers the query in this case? It is done in timer process, so it could be acc, usrloc, sqlops... there should be eventuall some other error messages around those printed by db_mysql.</p>

<p>A solution would be to try to do queries more often on timer module. That can be achieved using rtimer, defining one that uses the main timer (mode=0) and execute a route block where you do a simple query.</p>

<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/issues/406#issuecomment-180250223">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZSjtHeb6wxca00otJuKjT-4hQSzWks5phFa5gaJpZM4Gmb_R.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/issues/406#issuecomment-180250223"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>