Forum Discussion

Moritz_Möller_6's avatar
Moritz_Möller_6
Icon for Nimbostratus rankNimbostratus
Feb 14, 2006

iRule says "pool a" but request is going to pool b

Hi Forum,

 

 

i have a problem that's driving me crazy...

 

 

This is my iRule:

 

 

when HTTP_REQUEST {

 

set fn [URI::basename [HTTP::uri]];

 

set ext [string range $fn [string last "." $fn] 999];

 

if { [ matchclass $::static contains $ext ] } {

 

HTTP::header replace "Dbg" "static";

 

pool "static";

 

} else {

 

HTTP::header replace "Dbg" "game-www";

 

pool "game-www";

 

}

 

}

 

 

class $::static contains .gif, .jpg etc.

 

pool static contains a node for static content, pool game-www contains several nodes for dynamic content.

 

 

Now if i Dump the requests going to the Servers (Dump-Script attached), i see requests on the static webserver that should go to the game-www pool (the Dbg header says "game-www").

 

 

> game-www3:~ dumpHttpRequests | grep static

 

> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

 

> listening on eth0, link-type EN10MB (Ethernet), capture size 4096 bytes

 

> [bigip.4840->game-www3.80] http://www.lofd.de/pict/li-h.jpg [static]

 

 

The value in square brackets is the contents of the Dbg header.

 

 

 

 

Any idea how this can happen?

 

 

 

[Edit]

 

Only a really small amount (0.1% of all requests) go to wrong pools. I dumped the HTTP::request_num value with each request and noted that it is always >1.. We use a OneConnect-Profile, but the error occurs if it is disabled, too.

 

 

 

 

[Edit2]

 

I appendet the following code after the pool xxx statement:

 

 

pool "static"

 

if { [LB::server pool] != "static" } {

 

log "err1 [LB::server pool] != static"

 

}

 

 

occasionally i see these error messages in the log file. once a second maybe. why does this only happen sometimes?

 

 

 

[Edit3]

 

It seems as if the problems occur on some Keep-Alive Connections.

 

If i add a 'when HTTP_RESPONSE { HTTP::close; }' the errors go away.

 

Looks like the pool selection is persistent for all requests coming from a single connection?

 

log "[LB::server pool]" at the very beginning of the rule occasionally prints "static" although the default pool is "game-www".

 

 

2 Replies

  • Have you tried removing the quotes from the pool names? (e.g. game-www instead of "game-www"). I don't know if that matters, but that's something that jumped out at me first because I've never put that stuff in quotes.
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    This has puzzled me for a bit, but then I think there might be a couple of mistakes that are just all lined up.

    First, I will explain, that in general the bigip does not reset the pool selection back to the default. The pool selection remains with the last pool picked. This is true until the LB action happens. So, even though you have indicated a new pool with the pool command, the "LB::server pool" command may return the last selected pool until the new LB action has taken place. To make things more complicated, this behavior does change when using oneconnect.

    That being said, I think the behavior you noticed in edits 1-3 is understood. This made me then look closer at your original rule. I'm thinking there might be some parsing cases that are slipping through.

    I've optimized your rule a little and made it a little more direct about what your trying to do. Can you try this and see if it makes a difference.

    when HTTP_REQUEST {
      set fn [URI::basename [HTTP::uri]]
      if { [ matchclass $fn ends_with $::static ] } {
        HTTP::header replace "Dbg" "static";
        pool "static";
      } else {
        HTTP::header replace "Dbg" "game-www";
        pool "game-www";
      }
    }

    There are some subtle differences to which side you place the class and the variable in matchclass which I've already discussed in this post (Click here😞

    http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=1235