<h3>Description</h3>
<p>Timer on pipelimit doesn't seem to be working. When changing the time interval the limit gets changed in a way that it's multiplied by the time interval. For example if I use a time interval of 1 second and a limit of 20 (if (!pl_check("$si", "TAILDROP", "20"))) the module start limiting right after the traffic gets over 20 CPS. But if I change the time interval to 3 seconds, the module starts limiting the traffic right after 60 CPS. This is my configuration:</p>
<h1>----- pipelimit params-----</h1>
<p>modparam("pipelimit", "timer_interval", 3)<br>
modparam("pipelimit", "hash_size", 10)<br>
modparam("pipelimit", "db_url", DBURL)<br>
modparam("pipelimit", "reply_code", 503)<br>
modparam("pipelimit", "reply_reason", "Limiting")</p>
<p>...<br>
...<br>
...</p>
<p>request_route {<br>
...<br>
...<br>
if(is_method("INVITE")) {<br>
$var(limit) = 20;<br>
if (!pl_check("$si", "TAILDROP", "$var(limit)")) {<br>
xlog("L_INFO", "[$ci] $si - Limiting INVITE using pipe $var(limit) req/sec\n");<br>
pl_drop();<br>
exit;<br>
}<br>
.....<br>
.....<br>
.....<br>
}<br>
}</p>
<p>Checking the source for pipelimit module (<a href="https://github.com/kamailio/kamailio/blob/master/src/modules/pipelimit/pipelimit.c">https://github.com/kamailio/kamailio/blob/master/src/modules/pipelimit/pipelimit.c</a>) I see that for taildrop it's checking for the limit times the time_interval:</p>
<p>case PIPE_ALGO_TAILDROP:<br>
ret = (pipe->counter <= pipe->limit * timer_interval) ? 1 : -1;<br>
break;</p>
<p>I've made a change eliminating the time_interval (set it to 1) from that check and after that I've got the limit working OK, and the traffic gets drop right after it's over the limit (20 cps) using any time_interval. Is there some issue with the timer for the check not being updated by the module settings (timer_interval)? I'm using kamailio 4.4 and I've also tested it in kamailio 4.3 and 5.1 with same results.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<h4>Debugging Data</h4>
<h3>Additional Information</h3>
<p>version: kamailio 4.4.6 (x86_64/linux) 212b33<br>
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: 212b33<br>
compiled on 13:02:03 Dec 15 2017 with gcc 4.9.2</p>
<ul>
<li><strong>Operating System</strong>:<br>
Linux sjc-lb-test-cps.telnyx.com 3.16.0-4-amd64 <a href="https://github.com/kamailio/kamailio/issues/1" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="31891578" data-permission-text="Issue title is private" data-url="https://github.com/kamailio/kamailio/issues/1">#1</a> SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1390">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZVYtha88bCWPxSG63IW1y60GVyl7ks5tG5C-gaJpZM4RRznV">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZRM1JZ2dLfM_dP5ADPdqKWzAmwjgks5tG5C-gaJpZM4RRznV.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/1390"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Pipelimit timer doesn't seem to be working (#1390)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1390"}}}</script>