Forum Discussion
darragh_19954
Nimbostratus
Nov 09, 2007TCL runtime error with persist lookup
Hi,
We are using an iRule to manage users between 2 pools of servers, based on various bespoke rules.
When the requests are from cookie-enabled clients, we can successfully use cookies to keep the session (& repeat visits) sticky to a particular pool.
However, if the user has cookies-disabled, we're trying to use a Universal Persistance rule based on the IP/UA combination to keep the session sticky to a pool.
Here's the code in it's simpliest format that I can't get to work:
when HTTP_REQUEST {
construct the ID to use for persistence
set id "[IP::client_addr][HTTP::header User-Agent]"
look up this ID in persistence table (this fails)
set persistInfo [persist lookup uie id]
do lots of stuff based on results
...
persist on this id for future requests
persist uie id 300
go to a particular pool
pool poolA
return
}
The page fails to direct to either pool and the error message in the log is:
TCL error: Rule AB_test_rule1 HTTP_REQUEST - Prerequisite operation not in progress line 1 invoked from within persist lookup uie id
Any thoughts?
The only way I can avoid this failure is if I use a lookup statement like this:
set persistInfo [persist lookup uie {id pool poolA}]
but my understanding is this will only lookup poolA? However, while the id does get saved to the persistence tables, it never returns a value upon repeat requests.
I'm stumped.
Does anyone know any solutions to this or a page of decent examples of [persist] in action within iRules?
thanks a million
darragh
3 Replies
- spark_86682Historic F5 AccountHi! Looking at your config, two things jump out at me here. First, the most common cause of the "Prerequisite operation not in progress" error from the session or persist commands is not having a default pool assigned to the VIP that this iRule is assigned to. Do you have a default pool assigned? If not, try adding it. Second, I think the line up there should read:
set persistInfo [persist lookup uie $id]
(you're missing the "$" in "$id") - darragh_19954
Nimbostratus
Can't believe I missed the $! Thanks for that rather obvious one ...
You mentioned a default pool. Is that something we specify as part of the iRule or through the GUI to BIG-IP? - darragh_19954
Nimbostratus
Thanks to the help above and some more scurrying around, we got it working. Here's how it was done:
In the BIG-IP GUI, we specified a default pool and persistence profile (universal) under the resources tab of the virtual server running the iRule.
We then used the [session] command to store the pool outcome for a given IP/UA combination when we suspected the client was cookie-disabled.
Here's the code we used in the HTTP_REQUEST event:
create sessionID from IP and UA combianton (removing spaces)
set SessionID [string map {" " "_"} "[IP::remote_addr].[HTTP::header User-Agent]"]
check persistence table for previous requests
switch [session lookup uie $SessionID] {
"A" { set PoolVal "A" }
"B" { set PoolVal "B" }
default {
do other stuff to set Pool value
}
}
based on pool value, set the destination pool for request
switch $PoolVal {
"A" { pool poolA }
"B" { pool poolB }
default { pool poolA }
}
persist the session ID for repeat requests
session add uie $SessionID $PoolVal 1800
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
