<div dir="ltr">Could it be that you have a 5s timeout on your backend?<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 29, 2019 at 10:24 PM Maninder Singh <<a href="mailto:mandys@gmail.com">mandys@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi <span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px">Guillaume,</span><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px"><br></span></div><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px">Any idea on what the 5 sec timeout might be ( which happens only 3-4 times a day ) ?</span></div><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px"><br></span></div><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px">Is it the timeout_idle as mentioned by Dridi ?</span></div><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px"><br></span></div><div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px">What can be done to fix it ?</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 27 Dec 2019 at 14:22, Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Here are the different timeouts:</div><div><br></div><div><p style="box-sizing:border-box;margin:10px 0px 0px;color:rgb(31,50,63);font-family:"Work Sans",Arial,sans-serif;font-size:15px;background-color:rgb(244,244,244)"><strong style="box-sizing:border-box">timeout_idle</strong> (default: 5 seconds): How long we will wait from we `accept()` the connection, until the client must have sent us a non-whitespace character. (typically this will be the G in "GET /url HTTP/1.1")<br></p></div><div><br></div><div>Isn't idle_timeout for client to varnish requests ??</div><div><br></div><div>Also, just so that you know, these requests dont make it to apache logs also.</div><div><br></div><div><br></div><div><br></div>backend_idle_timeout 60.000 [seconds] (default)<br><div>between_bytes_timeout 60.000 [seconds] (default)<br></div><div>cli_timeout 60.000 [seconds] (default)<br></div><div>connect_timeout 3.500 [seconds] (default)<br></div><div>first_byte_timeout 60.000 [seconds] (default)<br></div><div>idle_send_timeout 60.000 [seconds] (default)<br></div><div>pipe_timeout 60.000 [seconds] (default)<br></div><div>send_timeout 600.000 [seconds] (default)<br></div><div>thread_pool_timeout 300.000 [seconds] (default)<br></div><div>timeout_idle 5.000 [seconds] (default)<br></div><div>timeout_linger 0.050 [seconds] (default)<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 27 Dec 2019 at 13:15, Dridi Boukelmoune <dridi@varni.sh> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Dec 27, 2019 at 1:00 AM Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br>
><br>
> I only have php-fpm slow logging for requests greater than 5secs. Otherwise it should be all defaults for varnish/apache/fpm.<br>
><br>
> Does varnish or apache have anything defaulting to 5secs?<br>
<br>
timeout_idle defaults to 5s<br>
<br>
> Otherwise fpm might be closing the connection for logging a slow request ? Strange?<br>
><br>
> On Thu, 26 Dec, 2019, 10:44 pm Guillaume Quintard, <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>> wrote:<br>
>><br>
>> The first looks like the backend is just closing the door on you. The other one (Resource temporarily unavailable), because of the Timestamp:Beresp, is most probably a timeout (did you set anything to 5s?)<br>
>><br>
>> --<br>
>> Guillaume Quintard<br>
>><br>
>><br>
>> On Thu, Dec 26, 2019 at 3:12 PM Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br>
>>><br>
>>> Another one.<br>
>>> This one is diff error.<br>
>>><br>
>>> * << BeReq >> 19327398<br>
>>> - Begin bereq 19327397 pass<br>
>>> - Timestamp Start: 1577370022.344818 0.000000 0.000000<br>
>>> - BereqMethod POST<br>
>>> - BereqURL /LetsCelebrate<br>
>>> - BereqProtocol HTTP/1.1<br>
>>> - BereqHeader User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36<br>
>>> - BereqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9<br>
>>> - BereqHeader Cache-Control: max-age=0<br>
>>> - BereqHeader SSLClientCertStatus: NoClientCert<br>
>>> - BereqHeader X-Forwarded-Proto: https<br>
>>> - BereqHeader Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBBVOJciq1v4rbZs9<br>
>>> - BereqHeader Accept-Language: en-GB,en-US;q=0.9,en;q=0.8<br>
>>> - BereqHeader SSLClientCipher: SSL_ECDHE_RSA_WITH_AES_256_GCM_SHA384, version=TLSv1.2, bits=256<br>
>>> - BereqHeader Host: <a href="http://mydomain.com" rel="noreferrer" target="_blank">mydomain.com</a><br>
>>> - BereqHeader Referer: <a href="https://mydomain.com/LetsCelebrate" rel="noreferrer" target="_blank">https://mydomain.com/LetsCelebrate</a><br>
>>> - BereqHeader SSLSessionID: 97258494A3DD008A855B552F701E9F95C25CDC7B1CF5FD63D382ED09391585C7<br>
>>> - BereqHeader Origin: <a href="https://mydomain.com" rel="noreferrer" target="_blank">https://mydomain.com</a><br>
>>> - BereqHeader X-Cluster-Client-Ip: X.X.X.X<br>
>>> - BereqHeader X-Forwarded-Port: 443<br>
>>> - BereqHeader Upgrade-Insecure-Requests: 1<br>
>>> - BereqHeader Sec-Fetch-User: ?1<br>
>>> - BereqHeader Sec-Fetch-Site: same-origin<br>
>>> - BereqHeader Sec-Fetch-Mode: nested-navigate<br>
>>> - BereqHeader Accept-Encoding: gzip, deflate, br<br>
>>> - BereqHeader Content-Length: 2076<br>
>>> - BereqHeader X-Forwarded-For: X.X.X.X, 10.187.187.36<br>
>>> - BereqHeader browser: other<br>
>>> - BereqHeader serverIp: 10.208.225.235<br>
>>> - BereqHeader X-Varnish: 19327398<br>
>>> - VCL_call BACKEND_FETCH<br>
>>> - VCL_return fetch<br>
>>> - BackendOpen 23 reload_2019-12-18T054238.default 127.0.0.1 8080 127.0.0.1 39568<br>
>>> - BackendStart 127.0.0.1 8080<br>
>>> - FetchError req.body read error: 11 (Resource temporarily unavailable)<br>
>>> - FetchError backend write error: 11 (Resource temporarily unavailable)<br>
>>> - Timestamp Bereq: 1577370027.344908 5.000090 5.000090<br>
>>> - BackendClose 23 reload_2019-12-18T054238.default<br>
>>> - Timestamp Beresp: 1577370027.345014 5.000196 0.000105<br>
>>> - Timestamp Error: 1577370027.345025 5.000206 0.000011<br>
>>> - BerespProtocol HTTP/1.1<br>
>>> - BerespStatus 503<br>
>>> - BerespReason Service Unavailable<br>
>>> - BerespReason Backend fetch failed<br>
>>> - BerespHeader Date: Thu, 26 Dec 2019 14:20:27 GMT<br>
>>> - BerespHeader Server: Varnish<br>
>>> - VCL_call BACKEND_ERROR<br>
>>> - BerespHeader Content-Type: text/html; charset=utf-8<br>
>>> - BerespHeader Retry-After: 5<br>
>>> - VCL_return deliver<br>
>>> - Storage malloc Transient<br>
>>> - ObjProtocol HTTP/1.1<br>
>>> - ObjStatus 503<br>
>>> - ObjReason Backend fetch failed<br>
>>> - ObjHeader Date: Thu, 26 Dec 2019 14:20:27 GMT<br>
>>> - ObjHeader Server: Varnish<br>
>>> - ObjHeader Content-Type: text/html; charset=utf-8<br>
>>> - ObjHeader Retry-After: 5<br>
>>> - Length 1288<br>
>>> - BereqAcct 1276 0 1276 0 0 0<br>
>>> - End<br>
>>><br>
>>> On Thu, 26 Dec 2019 at 17:27, Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br>
>>>><br>
>>>> Got one in the log.<br>
>>>><br>
>>>> varnishlog -r /var/log/varnish/503.log<br>
>>>> * << BeReq >> 21993384<br>
>>>> - Begin bereq 21993383 pass<br>
>>>> - Timestamp Start: 1577360704.829258 0.000000 0.000000<br>
>>>> - BereqMethod POST<br>
>>>> - BereqURL /corp/contact.php?cf=exitpopup<br>
>>>> - BereqProtocol HTTP/1.1<br>
>>>> - BereqHeader User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko<br>
>>>> - BereqHeader Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*<br>
>>>> - BereqHeader SSLClientCertStatus: NoClientCert<br>
>>>> - BereqHeader X-Forwarded-Proto: https<br>
>>>> - BereqHeader Content-Type: application/x-www-form-urlencoded<br>
>>>> - BereqHeader SSLClientCipher: SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA, version=TLSv1, bits=256<br>
>>>> - BereqHeader Host: <a href="http://www.mydomain.com" rel="noreferrer" target="_blank">www.mydomain.com</a><br>
>>>> - BereqHeader Referer: <a href="http://mydomain.com/solutions/enterprise.php" rel="noreferrer" target="_blank">http://mydomain.com/solutions/enterprise.php</a><br>
>>>> - BereqHeader SSLSessionID: 3C119EF3FE70318789F82E9B583581C876B4DDE520C0182C33CD6AF1AA46E63A<br>
>>>> - BereqHeader X-Cluster-Client-Ip: X.X.X.X<br>
>>>> - BereqHeader Cookie: X-Mapping-fjhppofk=E8F494E9A630955F1975EEDF11EBC4D7<br>
>>>> - BereqHeader X-Forwarded-Port: 443<br>
>>>> - BereqHeader Accept-Encoding: gzip, deflate<br>
>>>> - BereqHeader Content-Length: 1366<br>
>>>> - BereqHeader X-Forwarded-For: X.X.X.X, 10.187.187.36<br>
>>>> - BereqHeader browser: other<br>
>>>> - BereqHeader serverIp: 10.208.224.192<br>
>>>> - BereqHeader X-Varnish: 21993384<br>
>>>> - VCL_call BACKEND_FETCH<br>
>>>> - VCL_return fetch<br>
>>>> - BackendOpen 26 reload_2019-12-18T054253.default 127.0.0.1 8080 127.0.0.1 59998<br>
>>>> - BackendStart 127.0.0.1 8080<br>
>>>> - Timestamp Bereq: 1577360705.664932 0.835674 0.835674<br>
>>>> - FetchError http first read error: EOF<br>
>>>> - BackendClose 26 reload_2019-12-18T054253.default<br>
>>>> - Timestamp Beresp: 1577360705.665020 0.835763 0.000089<br>
>>>> - Timestamp Error: 1577360705.665028 0.835770 0.000008<br>
>>>> - BerespProtocol HTTP/1.1<br>
>>>> - BerespStatus 503<br>
>>>> - BerespReason Service Unavailable<br>
>>>> - BerespReason Backend fetch failed<br>
>>>> - BerespHeader Date: Thu, 26 Dec 2019 11:45:05 GMT<br>
>>>> - BerespHeader Server: Varnish<br>
>>>> - VCL_call BACKEND_ERROR<br>
>>>> - BerespHeader Content-Type: text/html; charset=utf-8<br>
>>>> - BerespHeader Retry-After: 5<br>
>>>> - VCL_return deliver<br>
>>>> - Storage malloc Transient<br>
>>>> - ObjProtocol HTTP/1.1<br>
>>>> - ObjStatus 503<br>
>>>> - ObjReason Backend fetch failed<br>
>>>> - ObjHeader Date: Thu, 26 Dec 2019 11:45:05 GMT<br>
>>>> - ObjHeader Server: Varnish<br>
>>>> - ObjHeader Content-Type: text/html; charset=utf-8<br>
>>>> - ObjHeader Retry-After: 5<br>
>>>> - Length 1288<br>
>>>> - BereqAcct 849 1366 2215 0 0 0<br>
>>>> - End<br>
>>>><br>
>>>> On Thu, 26 Dec 2019 at 15:21, Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> Okay. Let me set it up and get back to you once i see something in that log. It happens only once/twice a day so could be a while before i get back.<br>
>>>>><br>
>>>>> On Thu, 26 Dec, 2019, 3:10 pm Guillaume Quintard, <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>> wrote:<br>
>>>>>><br>
>>>>>> Hi,<br>
>>>>>><br>
>>>>>> Most probably, varnishncsa isn't going to give you the full picture, so let's go for the exhaustive way:<br>
>>>>>><br>
>>>>>> varnishlog -q "BerespStatus eq 503" -w /whatever/file<br>
>>>>>><br>
>>>>>><br>
>>>>>> you can then read the logs with<br>
>>>>>><br>
>>>>>> varnishlog -r /whatever/file<br>
>>>>>><br>
>>>>>><br>
>>>>>> (more logging pointers here: <a href="https://docs.varnish-software.com/tutorials/vsl-query/" rel="noreferrer" target="_blank">https://docs.varnish-software.com/tutorials/vsl-query/</a>)<br>
>>>>>><br>
>>>>>> If you can get your hands on a failed transaction, we should be able to tell you what went wrong. Most probably, you hit a timeout of some sort. Or it could be that the backend was declared sick, if you have probes.<br>
>>>>>><br>
>>>>>> --<br>
>>>>>> Guillaume Quintard<br>
>>>>>><br>
>>>>>><br>
>>>>>> On Thu, Dec 26, 2019 at 6:33 AM Maninder Singh <<a href="mailto:mandys@gmail.com" target="_blank">mandys@gmail.com</a>> wrote:<br>
>>>>>>><br>
>>>>>>> Hi,<br>
>>>>>>><br>
>>>>>>> I am facing a strange problem.<br>
>>>>>>><br>
>>>>>>> I am running varnish 4.1.11 on port 80 which is behind a LB.<br>
>>>>>>><br>
>>>>>>> Varnish then connects to apache 2.4 ( on port 8080 ) and also have php-fpm running.<br>
>>>>>>><br>
>>>>>>> Now, everything works fine but once in a while I am seeing 503 response from varnish for a POST request. During this time there is no log in apache also ( neither access log nor error log ).<br>
>>>>>>><br>
>>>>>>> Where does this request vanish ?<br>
>>>>>>><br>
>>>>>>> How do I debug this issue ?<br>
>>>>>>><br>
>>>>>>> Some more details:<br>
>>>>>>><br>
>>>>>>> * I have varnishncsa turned on with following flags.<br>
>>>>>>><br>
>>>>>>> ExecStart=/usr/bin/varnishncsa -q 'not (ReqURL ~ "\.(js|css|png|jpeg|jpg|ico|gif|swf|woff)" or ReqHeader:User-Agent ~ "HTTP-Monitor" or ReqHeader:User-Agent ~ "Monitoring/1.1")' -a -w /var/log/varnish/varnishncsa.log -D -f /etc/sysconfig/varnishncsa<br>
>>>>>>><br>
>>>>>>> Here is the entry in varnish log during that time.<br>
>>>>>>><br>
>>>>>>> X.X.X.X, LB.IP.0.0 - - [25/Dec/2019:00:26:40 -0600] 2629363 "POST <a href="http://mydomain.com/LetsCelebrate" rel="noreferrer" target="_blank">http://mydomain.com/LetsCelebrate</a> HTTP/1.1" 503 1288 "<a href="https://referringdomain.com/LetsCelebrate?hostingUrl=https%3A%2F%2Fxy.abc.com" rel="noreferrer" target="_blank">https://referringdomain.com/LetsCelebrate?hostingUrl=https%3A%2F%2Fxy.abc.com</a>" "Mozilla/5.0 (Linux; Android 9; SM-A920F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36" "<a href="http://mydomain.com" rel="noreferrer" target="_blank">mydomain.com</a>" miss<br>
>>>>>>><br>
>>>>>>> In .vcl file I have following set.<br>
>>>>>>> .first_byte_timeout = 120s;<br>
>>>>>>><br>
>>>>>>> Now, I am not logging varnish to apache requests ( which backend fetch ).<br>
>>>>>>> As you can see above I am only logging client requests.<br>
>>>>>>><br>
>>>>>>> Is their a way to log client requests like above but then also log backend fetch failures to another log file ?<br>
>>>>>>> [ Running 2 instances of varnishncsa ? ]<br>
>>>>>>><br>
>>>>>>> Any pointers ?<br>
>>>>>>><br>
>>>>>>> Please let me know.<br>
>>>>>>><br>
>>>>>>> Thanks.<br>
>>>>>>><br>
>>>>>>> _______________________________________________<br>
>>>>>>> varnish-misc mailing list<br>
>>>>>>> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
>>>>>>> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
><br>
> _______________________________________________<br>
> varnish-misc mailing list<br>
> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>