Forum Discussion

Anthony's avatar
Anthony
Icon for Nimbostratus rankNimbostratus
Mar 01, 2017

when CLIENT_CLOSED timing out

Hi all, I have an iRule which is used for logging the complete connection against a test environment. I run the following events:

 

  • when CLIENT_ACCEPTED
  • when CLIENTSSL_CLIENTHELLO
  • when CLIENTSSL_CLIENTCERT
  • when CLIENTSSL_HANDSHAKE
  • when CLIENTSSL_DATA
  • when HTTP_REQUEST
  • when HTTP_REQUEST_DATA
  • when SERVER_CONNECTED
  • when HTTP_RESPONSE
  • when CLIENT_CLOSED

For some reason we are now seeing certain tests taking a much longer time. This manifests itself by the CLIENT_CLOSED event not triggering (logging), and the response taking around 15seconds to show at the client. When I remove the iRule from the VS, the repsonse time is normal (~50ms). What I'm wondering is, if the application isn't closing the connection, would the iRule wait for this and hence the timeout?

 

Thanks for any advice,

 

Anthony

 

4 Replies

  • Hi,

     

    an irule suspend request / response since the event irule is ended.

     

    if one event takes too much time to execute, it will slow down the request / response.

     

    can you share your irule?

     

  • Hello, maybe the iRule are expecting to collect data such HTTP::collect. Are you doing collect after release data? Is just my shot. Maybe you could share the irule code to the f5 ninjas.

     

    Regards.

     

  • Just put it below - please feel free to take a look...

     

  • Hi,

     

    I think you are collecting even the verbs don't have body, such GET, HEAD, etc. So, I edited that to consider only POST verb. If this is an webservice or something else, you should include another verbs to consider the collect.

     

    This is what I would like to change:

     

    when HTTP_REQUEST {
        catch {HTTP::header remove "Accept-Encoding"}
        set headers ""
        set uri [HTTP::uri]
        if { [HTTP::method] eq "POST" } {
            if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 2048 } {
                set content_length [HTTP::header "Content-Length"] 
            } else { 
                set content_length 2048 
            }
            if { $content_length > 0} { 
                HTTP::collect $content_length 
            }
        }
        log local0. "Client $ip | Request uri = [HTTP::method] $uri"
        foreach head [HTTP::header names] {
            append headers "$headers [HTTP::header values $head]"
        }
        if { [HTTP::header exists "X-Forwarded-For"] } {
            set xff [getfield [lindex [HTTP::header values X-Forwarded-For]  0] "," 1]
        }
        set cookies [string map {" " ","} [lsort [HTTP::cookie names]]]
        log local0. "Client $ip (XFF=$xff)| $headers"
    }
    when HTTP_REQUEST_DATA {
        log local0. "Client $ip | Payload: [HTTP::payload]"
    }
    when HTTP_RESPONSE {
        set resp_head ""
        if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576 } {
            set response_length [HTTP::header "Content-Length"]
        } else {
            set response_length 1048576
        }
        if { $response_length > 0 } {
            HTTP::collect $response_length
        }
        log local0. "Client $ip | Request uri = $uri | Response status code = [HTTP::status] $response_length"
        foreach head [HTTP::header names] {
            append resp_head "$head=[HTTP::header values $head]"
        }
        log local0. "Response headers: $resp_head"
    }
    when HTTP_RESPONSE_DATA {
        log local0. "Response payload: [HTTP::payload]"
    }
    

    Best regards.