Forum Discussion
Angel_Martinez_
Nimbostratus
Nov 03, 2008Command returned bad code: 12 while executing
Hi
we're "playing" with this iRule:
when SERVER_CONNECTED {
listen {
proto 17
timeout 60
bind [LINK::vlan_id] [IP::loca...
unRuleY_95363
Sep 20, 2005Historic F5 Account
First, yes it's normal that a TCL error causes the connection to be reset. Unfortunately, there really isn't another way to continue with the connection once the rule event returns an error.
There are two helpful tools in writing an iRule to be resilient to certain failures. The first is the use of the command "info exists" which is used to check whether a variable exists. If you are having problems with a variable that sometimes doesn't exist, then adding some logic that properly handles that case with the above command would be the right thing to do. The other helpful tool is the "catch" command. This command evaluates the argument and returns 0 or 1 depending on whether the evaluation returned an error or not. So, for example, you could write a rule that would in fact never fail like this:
when HTTP_REQUEST {
if { [catch {
if { ... } {
foo
} else {
bar
}
} myresult] != 0 } {
log local0. "My rule failed: $myresult"
}
}
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