<div dir="ltr">Hello Henning,<div><br></div><div>Thanks for answering.</div><div><br></div><div>> Did you check eventual issues from virtual machine or time sync services?</div><div><br></div><div>I haven't noticed anything unsual.</div><div><br></div><div>> Is the machine/service under high load?</div><div><br></div><div>No</div><div><br></div><div>> Do you have many timers running in parallel? You could try playing around with the read_time and timer priority parameters in core.</div><div><br></div><div>I'll take a look, thanks.</div><div><br></div><div>FYI, I have done a test where I added a log line inside the loop to update the number of ticks (<a href="https://github.com/kamailio/kamailio/blob/master/src/core/timer.c#L917-L918">https://github.com/kamailio/kamailio/blob/master/src/core/timer.c#L917-L918</a>). It looks like when the the behavior I'm talking about happens, this loop needs to be run many times because the value was outdated, which means that the timers that were added after the first tick, are going to be fired before they should.</div><div><br></div><div>I'm going to test the flags you mentioned and see if the problem still happens.</div><div><br></div><div>Thank you</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 9, 2022 at 10:21 AM Henning Westerholt <<a href="mailto:hw@gilawa.com">hw@gilawa.com</a>> wrote:<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 lang="DE" style="overflow-wrap: break-word;">
<div class="gmail-m_8866649632469066758WordSection1">
<p class="MsoNormal"><span>Hello Alberto,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">normally the timer should be stable and not jumping around.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Did you check eventual issues from virtual machine or time sync services? The time should not jump around.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Is the machine/service under high load? If yes, you could  consider using dedicated timer processes for some modules.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Do you have many timers running in parallel? You could try playing around with the read_time and timer priority parameters in core.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">-- <u></u>
<u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning Westerholt –
</span><span><a href="https://skalatan.de/blog/" target="_blank"><span lang="EN-GB" style="color:rgb(5,99,193)">https://skalatan.de/blog/</span></a></span><span lang="EN-GB"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kamailio services –
</span><span><a href="https://gilawa.com/" target="_blank"><span lang="EN-GB" style="color:rgb(5,99,193)">https://gilawa.com</span></a></span><span lang="EN-GB"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-dev <<a href="mailto:sr-dev-bounces@lists.kamailio.org" target="_blank">sr-dev-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>Alberto Izquierdo<br>
<b>Sent:</b> Tuesday, February 8, 2022 9:04 AM<br>
<b>To:</b> <a href="mailto:sr-dev@lists.kamailio.org" target="_blank">sr-dev@lists.kamailio.org</a><br>
<b>Subject:</b> [sr-dev] Timers firing too soon<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Hi all,<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I'm using Kamailio timers to execute a series of calls with a certain delay. I have found out that from time to time, the timers are triggered too soon, sometimes they are triggered 2/3 seconds before they should.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">There is nothing significant in the logs, some of the log lines previous to the premature call are:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:"Courier New"">10(16136) DEBUG: tm [timer.c:606]: wait_handler(): WAIT timer hit @1111936903 for 0x7f32cc4eede8 (timer_lm 0x7f32cc4eee70)<br>
10(16136) DEBUG: tm [timer.c:643]: wait_handler(): finished transaction: 0x7f32cc4eede8 (p:0x7f32cc34ee90/n:0x7f32cc34ee90)<br>
10(16136) DEBUG: tm [h_table.c:132]: free_cell_helper(): freeing transaction 0x7f32cc4eede8 from timer.c:652</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">And some other ones after the call are<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-family:"Courier New"">10(16136) DEBUG: tm [timer.c:494]: retr_buf_handler(): timer retr_buf_handler @1111937043 (0x7f32cc4efa18 -> 0x7f32cc4ef9f8 -> 0x7f32cc4ef6d8)<br>
10(16136) DEBUG: tm [timer.c:545]: retr_buf_handler(): new interval 2000 ms / 16 ticks (max 4000 ms)<br>
10(16136) DEBUG: tm [timer.c:329]: retransmission_handler(): request resending (t=0x7f32cc4ef6d8, SUBSCRIBE ... )<br>
10(16136) DEBUG: tm [timer.c:573]: retr_buf_handler(): timer retr_buf_handler @1111937043 (0x7f32cc4efa18 ->0x7f32cc4ef9f8->0x7f32cc4ef6d8) exiting min (16, 24)</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I have read in the documentation that it is normal to have a bit of delay in some of the timers, but it doesn't mention anything about this behavior. Is this normal?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Thank you.<u></u><u></u></p>
</div>
</div>
</div>
</div>

</blockquote></div>