Forum Discussion
Andy_Herrman_22
Nimbostratus
Jan 13, 2010How to track down rogue persistence values?
My virtual server is using Universal persistence with a somewhat complicated iRule that generates a persistence value from a couple parameters in the URL query string.
In general everyt...
Andy_Herrman_22
Nimbostratus
Jan 13, 2010Here's a trimmed-down version of my iRule. The `persist none` parts were the only change I made to fix the weird behavior.
when CLIENT_ACCEPTED {
set lastPersist ""
}
when HTTP_REQUEST {
Some semi-complicated logic runs to set this, but isn't relevant to the
issue. This will either set a real persistence value or one of the
constants used by the switch statement later.
set persistVal ""
Browsers tend to reuse connections when they can. Webservers see each
request as separate, but the load balancer works on connections, not
requests. Since the requests in the same connection may not share the
same perrsistence data we need to do an LB::detach to cause the request to
be routed properly.
if { $lastPersist != "" and $persistVal != $lastPersist } {
LB::detach
}
set lastPersist $persistVal
We only want to set persistence when there is persistence data in the
request. Static requests don't need any persistence. We still set the
lastPersist value though so that we can detect when the persistence value
has changed.
switch -- $persistVal {
"STATICREQ" {
Don't set any persistence for the request
persist none
}
"NOPERSIST" {
Don't set any persistence for the request
persist none
}
default {
log local0. "HTTP setting persist to: $persistVal"
persist uie $persistVal
}
}
}
I think the issue is related to the LB::detach. I'm guessing when the detach happens the string that stores the old persistence value is freed, but if no new one is provided by the iRule (the old behavior) it tries re-using it. Since it has been freed the string is now invalid, and so you get whatever happens to be in memory at that location.
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