<HTML><BODY>Hello Henning,<br><br>Thank you for answer.<br><br>There are no errors related to db queries in the log. According to mongodb log remove  requests from cleanup are made by Kamailio with instable interval from 1 min (as it is configured) to several minutes. Per documentation the same interval is used to clean and to sync contacts. It looks like that there is some race condition when contact is removed by cleanup process but new contact is not synced yet. So periodically we have no registrations in db and we cannot make a call to those phones.<br><br>So as result we have switched to db_mode=3 now.<br><br><br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
        Суббота, 28 апреля 2018, 17:54 +03:00 от Henning Westerholt <hw@kamailio.org>:<br>
        <br>
        <div id="">






<div class="js-helper js-readmsg-msg">
        <style type="text/css"></style>
        <div>
                <base target="_self" href="https://e.mail.ru/">
                
            <div id="style_15249272600000000039_BODY"><div class="class_1524935225">
<style>.class_1524935225 p, .class_1524935225 li{
}</style>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">Am Freitag, 27. April 2018, 11:11:34 CEST schrieb Konstantin Polyakov:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> We have met a new issue. </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> We use  db_mode=1 ( Write-Through scheme. All changes to usrloc are</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> immediately reflected in database too ).  timer_interval has default value</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> 60 seconds.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Problem description.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Some user agent is registered successfully in Kamailio registrar.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Its contact exists inside internal cache (ul.lookup command shows it).</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> But location table doesn't contain this contact. After several minutes (5-6</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> min) it becomes available in the location table too. The issue is</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> reproduced periodically. Most of the time everything is ok.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Is that expected behavior when internal cache is used?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Did somebody else observed such situation?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">> Is there some workaround? </p>
<p style="-qt-paragraph-type:empty;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">Hello Konstantin,</p>
<p style="-qt-paragraph-type:empty;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">sounds indeed strange. You probably already checked this, do you see any errors in the Kamailio log related to the database? Do you use some kind of replication or proxy infrastructure that may delay DB operations?</p>
<p style="-qt-paragraph-type:empty;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">Best regards,</p>
<p style="-qt-paragraph-type:empty;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;-qt-block-indent:0;text-indent:0px;-qt-user-state:0;">Henning</p></div></div>
            
        
                <base target="_self" href="https://e.mail.ru/">
        </div>

        
</div>


</div>
</blockquote>
<br>
<br>С уважением,<br>Константин Поляков.<br></BODY></HTML>