STREAM::expression and "thread safety"
Hi,
I don't think "thread safety" is the right term here, but kinda helps explain my question.
STREAM::expression can be changed in an iRule, and the documentation says it affects "this connection only":
https://devcentral.f5.com/wiki/irules.stream__expression.ashx
What happens if I'm changing this in HTTP_RESPONSE and there's multiple requests / responses on the same TCP connection? Will the STREAM::expression set in one HTTP_RESPONSE pollute the value set in another? Do multiple HTTP_REQUESTs and HTTP_RESPONSEs happen at the same time if there's many concurrent requests from the same browser?
Likewise, for STREAM::enable. I've already come across the issue where enabling STREAM::enable in one HTTP_RESPONSE causes other HTTP requests to also get processed. I think this is because the stream processing is enabled for a connection.
I now use the pattern:
when HTTP_REQUEST {
STREAM::disable
}
when HTTP_RESPONSE {
if {some condition holds} {
STREAM::enable
}
}
This means that the STREAM processing is disabled at the beginning of every request.
However, does this lead to a race condition if there are multiple requests executing in parallel? If response enables the stream, is it visible to other responses on the same connection?
i.e.
REQUEST 1 REQUEST 2
HTTP_REQUEST
(disable stream)
HTTP_REQUEST
(disable stream)
HTTP_RESPONSE
condition is true:
(enable stream)
(stream processing occurs)
HTTP_RESPONSE
condition is false:
(leave stream as-is)
(stream processing occurs anyway)