Forum Discussion

Ube_34341's avatar
Ube_34341
Icon for Nimbostratus rankNimbostratus
Feb 19, 2012

HTTP redirect iRule brings Virtual Server to refuse connections after 10 minutes

Hi All,

 

 

I've created an iRule that redirects any HTTP GETs to two different destinations (A & B) based on clock ticks (even and odd) or to destionation A if new request rate exceeds a threshold.

 

 

Everything works pretty cool, till something happens and the Virtual Server got stucked refusing any new connection on port 80. Any action on it (enable/disable, iRule modification, etc) brings everything back to normal work. Each client is supposed to be hitting the virtual server once every 10 seconds and the issue appears after 10/20 minutes.

 

 

Can anyone give me a hint on what's wrong with it?

 

 

Many thanks for now....

 

 

 

when RULE_INIT {

 

set static::rate 5

 

set static::interval 15

 

set static::tbl "table"

 

}

 

 

when HTTP_REQUEST {

 

set key [IP::client_addr]

 

set tbl ${static::tbl}_[virtual name]

 

set current [table keys -subtable $tbl -count]

 

if { $current >= $static::rate } {

 

HTTP::respond 302 Location A }

 

else {

 

table set -subtable $tbl $key " " indefinite $static::interval

 

set key [crc32 [clock clicks]]

 

set key [expr {$key & 1}]

 

switch $key {

 

0 {

 

HTTP::respond 302 noserver Location A }

 

1 {

 

HTTP::respond 302 noserver Location B }

 

}

 

}

 

}

 

 

  • till something happens and the Virtual Server got stucked refusing any new connection on port 80.if 3-way handshake cannot be completed, i think irule may not relate.