Lingering connections when adapting huge POST REQUEST from ecap

Asked by Jatin

Hi,

I get a POST request as below. As you can see that the content length is huge for this POST request. In our ecap adapter as soon we see this request we adapt this request and send back a payload response to the client. In most cases this works fine but now and then some request connections would stay in CLOSE_WAIT state with recv queue as huge as 700,00 bytes which we now understand corresponds to the content length in the POST request for example in this case.

I wanted to check with you that do you think that we could be doing something wrong in our POST request adaptation that could be causing squid to go in this state. or would you know based on your experience with squid code base that how could we avoid this or is this a bug?

POST https://play.google.com/log?format=json&hasfast=true&authuser=0 HTTP/1.1
Connection: keep-alive
Content-Length: 632784
Authorization: SAPISIDHASH 798a27becf38ae9c86bf61fddafdccd3dd4c8dc7
Origin: https://docs.google.com
X-Goog-AuthUser: 0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Accept: */*
X-Client-Data: CJW2yQEIpbbJAQjEtskBCKmdygEIqKPKAQixp8oBCL+nygEI4qjKARj5pcoB
Referer: https://docs.google.com/document/d/1RVCWJ3SmBf_Y8trn0rXNsLKFAogSS61m-5oGlQt-eZI/edit
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: ************************************
Host: play.google.com

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

> do you think that we could be doing something wrong in our POST request adaptation that could be causing squid to go in this state

I am not sure but suspect it is possible to put Squid into this state by doing something wrong in the REQMOD eCAP adapter. That does not mean you are doing something wrong, of course. Squid bugs could also cause this state.

What you should be doing is either properly consuming the request body in your REQMOD adapter (including consumption termination) or refusing to receive the request body at all.

Please keep in mind that giving the host application the adapted response does _not_ imply that your adapter is not interested in the virgin request body. You have to be explicit about whether you want to receive the virgin request body from the host application (and, if you do, when you no longer need it).

Revision history for this message
Jatin (jbhasin83) said :
#2

Hi Alex,
Could you please let me know how you tell squid from ecap that you don't want to receive virgin body.

Revision history for this message
Alex Rousskov (rousskov) said :
#3

From the host::Xaction class declaration:

    // virgin body transmission control
    virtual void vbDiscard() = 0; // adapter will not look at vb at all
    ...

Can you help with this problem?

Provide an answer of your own, or ask Jatin for more information if necessary.

To post a message you must log in.