Forum Discussion
AndrewO_4840
Nimbostratus
Feb 12, 2009How can this fail?
I'm using a variation of the request rate limiting iRule ( http://devcentral.f5.com/wiki/default.aspx/iRules/HTTPRequestThrottle.html ) - it's essentially the same without the whitelist or blacklist features.
The rule breaks on the line:
set elapsed_time [expr {$curr_time - $start_time}}
and throws the error:
> - can't use empty string as operand of "-" while executing "expr {$curr_time - $start_time}"
This rule contains the lines:
set curr_time [clock seconds]
and:
set request_count [session lookup uie $reqkey]
if {$request_count > 0} {
set start_time [session lookup uie $timekey]
...
Since $curr_time is defined, and $start_time is defined if the session lookup returns some value, how can either of them be 0 and cause my iRule to fail?
- Nicolas_Menant
Employee
Could it be possible to see the whole iRule ? - L4L7_53191
Nimbostratus
It looks like the interpreter thinks you're dealing with a literal empty string, not a zero (or other number). This is from a normal TCL command line, not a BigIP, but it's pretty easy to replicate:% set one [clock seconds] 1234571258 % set two "" % expr { $one - $two } can't use empty string as operand of "-" % % set two 0 0 % expr { $one - $two } 1234571258 %
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