Forum Discussion

Kevin_Davies_40's avatar
Sep 06, 2010

Globals not really global?

Hi,

 

 

In iRule A on VIP A I have set static::myversion "1.0"

 

in iRule B on VIP B I have if {[info exists static::myversion] } { ...

 

 

The problem is the second test only works half the time then as time progresses it works maybe %80-90 of the time.

 

 

System is BIG-IP 3900 running 10.2 HFA1 based on Xeon Quad Core Processor.

 

 

What am I missing here?

 

 

Jarvil

4 Replies

  • Hello Jarvil,

     

     

    Would you mind posting both the iRules and maybe a little information about the VIP's that you have applied them to? It will really help folks to diagnose the problem.
  • As I remember, a tmm instance is running on each core. With a 3900, there will be 4 tmm's (most likely). I believe the global variable is global to the tmm instance, not the LTM as a whole. This would account for working sometimes and not others. Until the global is set on each tmm instance, you would have the problem of it not being found sometimes.

     

  • I think variables in the static:: namespace are only sync'd across the TMM's during RULE_INIT. Any changes to the static:: variable in RULE_INIT should work fine. Changes to static:: variables after RULE_INIT won't be synched. Checking if the static:: variable exists should always work (assuming you're not unsetting the variable in a rule). If you're using true global variables, then the VS should be demoted automatically from CMP and only run on one TMM instance.

     

     

    As Naladar suggested, if you're seeing that 'info exists' test fail, it would help if you could post the iRules you're testing with. You could also open a case with F5 Support to investigate the issue further.

     

     

    Aaron
  • Thanks for the help guys,

     

     

    I dumped it when it wasnt reliable. I will ensure I post a great deal more information in the future. Essentially I have stopped using globals entirely. In order to update a static global or any iRule that uses RULE_INIT you need to restart bigip to trigger the event. This is far from ideal in a production multi-customer environment. In the end it was better to use local vars as they are global across your iRules, then use the session uie table to store persistent information. This way when I update an iRule variable I dont have to take down the box to do it and its all CMP friendly.

     

     

    Regards

     

     

    Jarvil