Forum Discussion

danz_123652's avatar
danz_123652
Icon for Nimbostratus rankNimbostratus
Sep 17, 2013

What is the Table variable data range?

While running our iRule, I am getting exception "Illegal value (line 1) invoked from within "table incr -subtable $tbl "AccumulatedResponseTime" $currentResponseTime"", which seems to suggest variable "AccumulatedResponseTime" value is out of range. It could happen if our external service failed to reset it. I would like to handle this exception more gracefully, but I couldn't find any information regarding variable data range. I am new to iRule, can someone please shed some light on this?

 

2 Replies

  • According to the wiki, table incr takes two options beyond the subtable name: the key and the delta. So in the above statement, the "AccumulatedResponseTime" string would be the key - an arbitrary string value, and $currentResponseTime would be the delta - or amount to increment by. Without the delta the (numeric) table entry would be incremented by 1. If the table entry didn't exist, the key would be created with a value of 0. Is it possible then that $currentResponseTime is not a number?

     

    You could, at the very least, encapsulate all of this in a catch statement:

     

    http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm

     

    Or verify that the delta value is a number before using it.

     

  • Interestingly, there actually may be a limit. I just tested on an 11.3 VE and the largest integer value seemed to be in the range of:

    9,999,999,999,999,999,999 (commas added for readability)
    

    You can check this value by logging it in the iRule:

    log local0. [table lookup -subtable $tbl "AccumulatedResponseTime"]