Forum Discussion

tarsier_90410's avatar
tarsier_90410
Icon for Nimbostratus rankNimbostratus
Apr 11, 2011

foreach items in list - behavior change in 10.x?

I am trying to find information regarding a change in behavior in the way foreach acts on lists from 9.x to 10.x and cannot find any previous threads on the matter. Is this an intentional change or a bug, and is there a work around to achieve the 9.x behavior in 10.x?

 

 

 

when HTTP_REQUEST {

 

set INFO {"1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "a" "b" "c" "d" "e" "f"}

 

foreach {a b c d} $INFO {

 

log local0. "$a $b $c $d"

 

}

 

}

 

 

 

 

 

9.2.5 build 5.1 log output

 

1 2 3 4

 

5 6 7 8

 

9 0 a b

 

c d e f

 

 

 

10.2.1 build 297 log output

 

1 1 1 1

 

2 2 2 2

 

3 3 3 3

 

4 4 4 4

 

 

 

  • Interesting - this looks like CMP to me, but it's just a hunch. Does this happen to be a 4-way box? I ask because 9.2.5 has a single TMM instance, and 10.2.1 will have 4 on a 4-way box. A quick way to test this theory is to 'demote' the virtual server. Put something like this in:

     

     

    when RULE_INIT {

     

    set ::demote_me 1

     

    }

     

    Which will set a global that will automatically demote that virtual and pin it to a single TMM instance. If you see your foreach working as expected then, that's the reason.

     

     

    Please post back if you get a chance to test this.

     

    -Matt
  • This is actually a bug described here:

     

     

    Unexpected result from foreach loop on 10.2

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1172718/showtab/groupforums/Default.aspx

     

     

    CR140814 - fixed in TMOS v10.2.1 HF1

     

     

    Aaron
  • Matt - disabling CMP did not help

     

     

    Aaron - thank you for the info regarding the bug, I was unable to find it using search
  • No problem. 10.2.1HF2 has recently been released. If you upgrade to 10.2.1, I suggest installing this:

     

     

    Hotfix-BIGIP-10.2.1-496.0-HF2

     

     

    Aaron