#607 load_balance does not return next gateway

1.10.x
closed-fixed
modules (454)
5
2013-05-10
2013-02-06
No

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@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@192.168.0.195,t=sip:17011231234@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@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'

Discussion

  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    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

     
  • Bogdan-Andrei Iancu

    • milestone: --> 1.9.x
     
  • Bogdan-Andrei Iancu

    • status: open --> open-fixed
     
  • Bogdan-Andrei Iancu

    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

     
  • Bogdan-Andrei Iancu

    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks