[OpenSIPS-Devel] [ opensips-Bugs-3603587 ] load_balance does not return next gateway

SourceForge.net noreply at sourceforge.net
Fri Feb 22 09:56:22 CET 2013


Bugs item #3603587, was opened at 2013-02-06 09:14
Message generated for change (Settings changed) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3603587&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: modules
Group: 1.9.x
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Matt Williams (hmmhesays)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: load_balance does not return next gateway

Initial Comment:
Calling load_balance() twice in request route does not return the next gateway in the set. 

route[2] {

        load_balance("$avp(778)","pstn","1");
        xlog("L_DEBUG", "\n===DESTINATION IS $du===\n");
        load_balance("$avp(778)","pstn","1");
        xlog("L_DEBUG", "\n===DESTINATION IS $du===\n");

        if ($retcode<0) {
             sl_send_reply("503","Service Unavailable - NO GATEWAYS");
             exit;
        }

        xlog("L_DEBUG","\n===CHECKING RATE LIMIT FOR $du===\n");

        if(!rl_check("lb_$du", "0", "TAILDROP")) {
                rl_dec_count("lb_$du");
                route(2);
                exit;

        }

        xlog("L_DEBUG", "Selected destination is: $du\n");

        # send it out
        if (!t_relay()) {
                sl_reply_error();
        }

        exit;



}


Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: found requested (0) resource pstn
Feb  6 12:05:23 [620844] DBG:core:parse_to_param: tag=1KppB6yttgg8N
Feb  6 12:05:23 [620844] DBG:core:parse_to: end of header reached, state=29
Feb  6 12:05:23 [620844] DBG:core:parse_to: display={"Datacomm, Tech Support"}, ruri={sip:7015410525 at 192.168.0.195}
Feb  6 12:05:23 [620844] DBG:dialog:build_new_dlg: new dialog 0x2b0792991880 (c=3c67be3a-eb22-1230-0184-0014227c3253,f=sip:7015410525 at 192.168.0.195,t=sip:17011231234 at 64.135.116.168:5062,ft=1KppB6yttgg8N) on hash 17929
Feb  6 12:05:23 [620844] DBG:core:parse_headers: flags=ffffffffffffffff
Feb  6 12:05:23 [620844] DBG:dialog:init_leg_info: route_set , contact sip:mod_sofia at 192.168.0.195:5080, cseq 39749097 and bind_addr udp:64.135.116.168:5062
Feb  6 12:05:23 [620844] DBG:dialog:dlg_add_leg_info: set leg 0 for 0x2b0792991880: tag=<1KppB6yttgg8N> rcseq=<0>
Feb  6 12:05:23 [620844] DBG:dialog:link_dlg: ref dlg 0x2b0792991880 with 3 -> 3
Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: destination <sip:192.168.0.172> selected for LB set with free=0 (max=0)
Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: destination <sip:192.168.0.170> selected for LB set with free=100 (max=100)
Feb  6 12:05:23 [620844] DBG:dialog:link_dlg_profile: Entered here with hash = 1

===DESTINATION IS sip:192.168.0.170===
Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: found requested (0) resource pstn
Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: destination <sip:192.168.0.172> selected for LB set with free=0 (max=0)
Feb  6 12:05:23 [620844] DBG:load_balancer:do_load_balance: destination <sip:192.168.0.170> selected for LB set with free=96 (max=96)
Feb  6 12:05:23 [620844] DBG:dialog:link_dlg_profile: Entered here with hash = 1

===DESTINATION IS sip:192.168.0.170===
Feb  6 12:05:23 [620844] DBG:core:comp_scriptvar: int 26 : -5 / 0
Feb  6 12:05:23 [620844] DBG:core:parse_headers: flags=ffffffffffffffff
Feb  6 12:05:23 [620844] DBG:dialog:next_state_dlg: unref dlg 0x2b0792991880 with 1 -> 2
Feb  6 12:05:23 [620844] DBG:dialog:next_state_dlg: dialog 0x2b0792991880 changed from state 1 to state 5, due event 1
Feb  6 12:05:23 [620844] DBG:dialog:dlg_onreply: dialog 0x2b0792991880 failed (negative reply)
Feb  6 12:05:23 [620844] DBG:dialog:unref_dlg: unref dlg 0x2b0792991880 with 1 -> 1
Feb  6 12:05:23 [620844] DBG:dialog:unref_dlg: unref dlg 0x2b0792991880 with 1 -> 0
Feb  6 12:05:23 [620844] DBG:dialog:unref_dlg: ref <=0 for dialog 0x2b0792991880
Feb  6 12:05:23 [620844] DBG:dialog:destroy_dlg: destroing dialog 0x2b0792991880
Feb  6 12:05:23 [620844] DBG:dialog:destroy_dlg: dlg expired or not in list - dlg 0x2b0792991880 [17929:2071505611] with clid '3c67be3a-eb22-1230-0184-0014227c3253' and tags '1KppB6yttgg8N' 'NULL'


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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2013-02-17 00:44

Message:
Hi Matt,

This bug is similar to 3604147 , which I just fixed. The marking of the
used destination (during the failover) was bogus if the destination ID was
higher than 8.

SVN is updated trunk, 1.9, 1.8, 1.7 , so please do not use the patch I
sent, update from SVN and try again, it should work now.

Regards,
Bogdan

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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2013-02-16 01:22

Message:
Hi, I tried your snip , but not able to reproduce what you reported. I
tested with 2 destination, here are the logs from lb module:

Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: found requested
(0) resource pstn
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.10> selected for LB set with free=100 (max=100)
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.15> selected for LB set with free=100 (max=100)
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: winning
destination <sip:127.0.0.10> selected for LB set with free=100
....
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: found requested
(0) resource pstn
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: sequential call
of LB - previous selected dst is 1
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: skipping
destination <sip:127.0.0.10> (used=1 , disabled=0)
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: destination
<sip:127.0.0.15> selected for LB set with free=100 (max=100)
Feb 16 11:20:00 [23849] DBG:load_balancer:do_load_balance: winning
destination <sip:127.0.0.15> selected for LB set with free=100


Please re-run your test with the attached patch which will provide more
debug info - and post here the logs from lb modules.

Thanks and regards,
Bogdan

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

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



More information about the Devel mailing list