Forum Discussion
Russell_E_Glaue
Nimbostratus
Feb 16, 2009no such pool Failed Tcl_pool_GetFromObj
I am receiving this error message, and cannot determine why it is occurring. I cannot even use TCL 'catch' to catch the error.
Feb 16 13:22:48 tmm tmm[1568]: 01220001:3: TCL error: dist__virtualhosting - no such pool Failed Tcl_pool_GetFromObj: pool (line 1) invoked from within "pool $http_host_pool"
Feb 16 13:22:48 tmm tmm[1568]: 01220001:3: TCL error: dist__virtualhosting - no such pool Failed Tcl_pool_GetFromObj: pool (line 14) invoked from within "pool $http_host_pool"
Here is the iRule:
-
when HTTP_REQUEST {
discover the server pool
set http_host_pool [HTTP::host]_pool
if { $http_host_pool equals "_pool" } {
log local0.err "The HTTP Host, [HTTP::host], is not defined."
}
if { [findstr $http_host_pool "www." 0 "4"] eq "www." } {
set http_host_pool [substr $http_host_pool 4 end]
}
test that the server pool exists
if { [catch [pool $http_host_pool] result] }{
log local0.err "pool $http_host_pool does not exist, Request: [HTTP::host][HTTP::uri], Result: $result"
}
set the server pool
pool $http_host_pool
}
-
I am confused: If there were really "no such pool...", then my iRule should log that the pool does not exist after this error is caught using "catch". But that is not happening. It looks like the error is not being caught at all.
Does anyone know why this is occurring?
-RG
- hoolio
Cirrostratus
Hi RG,when HTTP_REQUEST { discover the server pool set http_host_pool [string tolower [HTTP::host]]_pool if { $http_host_pool equals "_pool" } { log local0.err "The HTTP Host, [HTTP::host], is not defined." } if { [findstr $http_host_pool "www." 0 "4"] eq "www." } { set http_host_pool [substr $http_host_pool 4 end] } Try to use the pool. If it doesn't exist, log an error. if { [catch [pool $http_host_pool] result] }{ log local0.err "pool $http_host_pool does not exist, Request: [HTTP::host][HTTP::uri], Result: $result" } else { log local0.err "pool $http_host_pool does exist, Request: [HTTP::host][HTTP::uri], Result: $result" } }
- Russell_E_Glaue
Nimbostratus
I changed my catch statement to the following: - Russell_E_Glaue
Nimbostratus
Posted By hoolio on 02/16/2009 11:59 AM
Aaron
- hoolio
Cirrostratus
Hi RG,return 0 is false. Save the result of running the command 'return 0' to the variable named result if {[catch {return 0} result]}{ log local0. "catch was true, because return resulted in return code 0. Result: $result" } else { log local0. "catch was false, because return resulted in non-zero return code. Result: $result" }
if {[catch {set test 1} result] }{ log local0. "catch was true, because the set command returned with an error. Result: $result" } else { log local0. "catch was false, because the set command returned without error. Result: $result" } This log statement will run regardless of whether there is an error or not log local0. "\$test: $test (This log statement will run regardless of whether there is an error or not)"
if {[catch {set test $var_that_doesnt_exist} result]}{ log local0. "catch was true, because the set command returned with an error. Result: $result " } else { log local0. "catch was false, because the set command returned without error. Result: $result" }
- Russell_E_Glaue
Nimbostratus
Thanks - but I know all of this already.if { [catch [pool $http_host_pool] result] }{ log local0.err "pool $http_host_pool does not exist, Request: [HTTP::host][HTTP::uri], Result: $result" }
- hoolio
Cirrostratus
Sorry... I wasn't sure which part you were asking about. I think the problem is with the syntax you were using. If you wrap the statement being caught in square brackets [ ], that gets executed and is not handled as expected by catch. If you use curly braces { }, it should work and give you the output in $result.when HTTP_REQUEST { set pool_name "non_existent_pool" if {[catch {pool $pool_name} result]}{ log local0. "Caught error: $result" } }
- Russell_E_Glaue
Nimbostratus
Ahh!if { [catch {set test [active_members $http_host_pool]} result] }{
if { [catch [pool $http_host_pool] result] }{
if { [catch {[pool $http_host_pool]} result] }{
- hoolio
Cirrostratus
Catch will execute the code within the curly braces. It seems to work if you add square braces, but it shouldn't be necessary.
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