[OpenSIPS-Devel] [ opensips-Bugs-3603732 ] rl_dec_count increases counter

SourceForge.net noreply at sourceforge.net
Fri Feb 15 18:05:51 CET 2013


Bugs item #3603732, was opened at 2013-02-07 10:15
Message generated for change (Comment added) made by razvancrainea
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3603732&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Matt Williams (hmmhesays)
Assigned to: Razvan Crainea (razvancrainea)
Summary: rl_dec_count increases counter

Initial Comment:
Calling rl_dec_count_increases the counter. Test calls rl_check 3 times to increment the counter. 

 #We're only checking our gateway rate limits here;
        if(!rl_check("$avp(778)_$avp(271)", "$(avp(780){s.int})", "TAILDROP")) {
                rl_check("$avp(778)_$avp(271)", "$(avp(780){s.int})", "TAILDROP");
                rl_check("$avp(778)_$avp(271)", "$(avp(780){s.int})", "TAILDROP");
                rl_dec_count("$avp(778)_$avp(271)");
                rl_dec_count("$avp(778)_$avp(271)");
                rl_dec_count("$avp(778)_$avp(271)");
                #make sure counter doesn't go negative;
                rl_dec_count("$avp(778)_$avp(271)");
                route(route_failover);
                exit;
        }


Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test doens't exist, but was created 0x2b4307eb2428
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test counter:1 load:0 limit:0 should be blocked (0x2b4307eb2428)
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test found: 0x2b4307eb2428 - last used 1360260142
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test counter:2 load:0 limit:0 should be blocked (0x2b4307eb2428)
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test found: 0x2b4307eb2428 - last used 1360260142
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_check_3: Pipe test counter:3 load:0 limit:0 should be blocked (0x2b4307eb2428)
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_set_count: new counter for key test is 4
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_set_count: new counter for key test is 5
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_set_count: new counter for key test is 6
Feb  7 13:02:22 [15173] DBG:ratelimit:w_rl_set_count: new counter for key test is 7


attached patch fixes my issues. Needs review to see if it breaks anything else. 

----------------------------------------------------------------------

>Comment By: Razvan Crainea (razvancrainea)
Date: 2013-02-15 09:05

Message:
Hi, Matt!

Any updates? Please let me know if everything is ok before I commit the
fix.

Best regards,
Răzvan

----------------------------------------------------------------------

Comment By: Razvan Crainea (razvancrainea)
Date: 2013-02-09 23:18

Message:
Hi, Matt!

I have attached a new patch. Can you please give me a try and let me know
how it works?

Best regards,
Răzvan

----------------------------------------------------------------------

Comment By: Matt Williams (hmmhesays)
Date: 2013-02-08 09:46

Message:
Looks like this allows it to go negative for one count. 

Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test doens't
exist, but was created 0x2b0d5fa7eee8
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test counter:1
load:0 limit:0 should be blocked (0x2b0d5fa7eee8)
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test found:
0x2b0d5fa7eee8 - last used 1360345517
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test counter:2
load:0 limit:0 should be blocked (0x2b0d5fa7eee8)
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test found:
0x2b0d5fa7eee8 - last used 1360345517
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_check_3: Pipe test counter:3
load:0 limit:0 should be blocked (0x2b0d5fa7eee8)
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_set_count: new counter for key
test is 2
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_set_count: new counter for key
test is 1
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_set_count: new counter for key
test is 0
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_set_count: new counter for key
test is -1
Feb  8 12:45:17 [12405] DBG:ratelimit:w_rl_set_count: new counter for key
test is 0

----------------------------------------------------------------------

Comment By: Matt Williams (hmmhesays)
Date: 2013-02-08 09:40

Message:
Thank You, I will test it out. 

----------------------------------------------------------------------

Comment By: Razvan Crainea (razvancrainea)
Date: 2013-02-08 02:50

Message:
Hi, Matt!

Indeed, there was a bogus sign change issue related to the rl_dec_count
function. I have fixed this on trunk, 1.9 and 1.8 versions. Let me know if
there are any problems.

Best regards,
Răzvan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3603732&group_id=232389



More information about the Devel mailing list