Forum Discussion
Scope and integrity of local variables
- Oct 20, 2023
Toni1 As long as it is considered part of the same client connection you should be fine for both of these. Again, I have never had an instance where a variable for one user was unintentionally used by a different user. When the iRule initiates for that users connection any variables should be set so I don't think you have to worry about responses not having the variable.
Toni1 In the 15+ years that I have used it I have never had another clients accidentally share variables because of how iRules are executed. It is possible that you have set a variable and it's also possible that the pool member stripped the variable from the response. Your best bet here is to run a tcpdump and then open it in wireshark to confirm the variable is indeed being set and that the connection that is sent to the pool member contains the variable. This will allow you to see the response from the pool member as well to see if it has been removed.
- Toni1Oct 19, 2023Nimbostratus
Hi there,
That's good to know that realistically I probably don't have much to worry about... it's quite a big and important iRule, so i'm being a bit paranoid I suppose...
I guess my general lack of understanding is whether :
- There can be simultaneous requests/responses occuring for the same tcp connection (I read that http/2 might do that, but I wasn't sure), and if it is, could the local variables even in the same iRule event (given they are scoped to each connection) ever be in danger of being overwritten by other requests/responses from the same connection?
- And lastly is it technically possible to have a response without a request? I remembered that we make small use of websockets, so i'm wondering if a response that doesn't know about a local variable that was definately set in the beginning of the request might be due to websocket traffic instead of normal http traffic.
Thanks 🙂
Toni
- PauliusOct 20, 2023MVP
Toni1 As long as it is considered part of the same client connection you should be fine for both of these. Again, I have never had an instance where a variable for one user was unintentionally used by a different user. When the iRule initiates for that users connection any variables should be set so I don't think you have to worry about responses not having the variable.
Recent Discussions
Related Content
* 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