ERR_ICAP_FAILURE

Asked by joe on 2016-07-21

got error from status code 301 that shuld not happen

GET http://youtube.com/
Status: HTTP/1.1 500 Internal Server Error <-------???
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding gzip, deflate, sdch
Accept-Language en-US,en;q=0.8,fr;q=0.6
Cookie _ga=GA1.2.975123156.1449860584;
SID=ZQPfWKux0K_ruBa3SkKlwrv9LeWybn-kRTrulzhXhYUSTRZyVSOpEn1foUQd1avqMSzlTg.;
HSID=AdHXXeuK1d0QufhXo;
APISID=t199C2vzfaI-Uxj3/ATUpRzqEY_CbIEOb8;
LOGIN_INFO=c829e1431e0ecfc043238fe8792f00f3c0EAAAB7IjciOiAwLCAiNCI6ICJHQUlBIiwgIjMiOiAxMDk2NzM3ODgzLCAiMSI6IDEsICI4IjogOTY2Mjc2MDQ1MDIzfQ==;
PREF=f5=30&al=en&f1=50000000;
VISITOR_INFO1_LIVE=2UfhsRpoytE;
QfYrT.resume=;
YSC=8IGpqGiGJI8
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
X-Client-Data CIS2yQEIpbbJAQjEtskBCPGcygE=
Response Headers
Connection keep-alive
Content-Length 3158
Content-Type text/html;charset=utf-8
Date Thu, 21 Jul 2016 17:23:08 GMT
Mime-Version 1.0 <------------------notice Mime-Version from ecap or squid
Server squid
X-Cache MISS from proxy.netgatesss.com
X-Squid-Error ERR_ICAP_FAILURE 0 <--------------
*********************
without ecap
*********************************************
GET http://youtube.com/
Status: HTTP/1.1 301 Moved Permanently <--- and of corse i bypass any status inside the adapter just 200 alowed
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding gzip, deflate, sdch
Accept-Language en-US,en;q=0.8,fr;q=0.6
Cookie _ga=GA1.2.975123156.1449860584;
SID=ZQPfWKux0K_ruBa3SkKlwrv9LeWybn-kRTrulzhXhYUSTRZyVSOpEn1foUQd1avqMSzlTg.;
HSID=AdHXXeuK1d0QufhXo;
APISID=t199C2vzfaI-Uxj3/ATUpRzqEY_CbIEOb8;
LOGIN_INFO=c829e1431e0ecfc043238fe8792f00f3c0EAAAB7IjciOiAwLCAiNCI6ICJHQUlBIiwgIjMiOiAxMDk2NzM3ODgzLCAiMSI6IDEsICI4IjogOTY2Mjc2MDQ1MDIzfQ==;
PREF=f5=30&al=en&f1=50000000;
VISITOR_INFO1_LIVE=2UfhsRpoytE;
QfYrT.resume=;
YSC=8IGpqGiGJI8
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
X-Client-Data CIS2yQEIpbbJAQjEtskBCPGcygE=
Response Headers
Content-Length 0 <---------- has nothing to do with my adapter all 0 clen ar bypassed
Content-Type text/html
Date Thu, 21 Jul 2016 17:24:35 GMT
Location http://www.youtube.com/
Server YouTubeFrontEnd
X-Frame-Options SAMEORIGIN
X-XSS-Protection 1; mode=block

--------------------------
and here is my simple code wish is not finish but it shuld not caus the icap header error
void Adapter::Xaction::start() {

    Must(hostx);

    if (hostx->virgin().body()) {
        receivingVb = opOn;
        hostx->vbMake();
    } else {
        receivingVb = opNever;
    }
 // reading http status
    libecap::FirstLine *firstLine = &(hostx->virgin().firstLine());
    libecap::StatusLine *statusLine = NULL;
 statusLine = dynamic_cast<libecap::StatusLine*>(firstLine);
    if ((statusLine != NULL) {
         if(requirements() && statusLine->statusCode() == 200) {
   //do the work
   } else {
            hostx->useVirgin();
            abDiscard();
        }
    }
}

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
joe
Solved:
2016-07-24
Last query:
2016-07-24
Last reply:
2016-07-24

This question was reopened

  • 2016-07-22 by joe
Alex Rousskov (rousskov) said : #1

You forgot to ask the question!

Does everything work if you replace your Adapter::Xaction::start() implementation with the one below?

        // make this adapter non-callable
        libecap::host::Xaction *x = hostx;
        hostx = 0;
        // tell the host to use the virgin message
        x->useVirgin();

Please note that to understand why Squid is returning an error you would need to analyze cache.log with debug_options set to something like "ALL,7" or at least "93,9 ALL,3"

joe (joejoe) said : #2

tks alex your idea has helped me one of my code was miss placed

joe (joejoe) said : #3

hi alex again only wen ecap is on
 i try you suggestion
squid-3.5.19-20160524-r14057 and newer same error even v4

void Adapter::Xaction::start() {
        // make this adapter non-callable
        libecap::host::Xaction *x = hostx;
        hostx = 0;
        // tell the host to use the virgin message
        x->useVirgin();
}

2016/07/23 00:30:35.172 kid1| 88,3| client_side_reply.cc(1772) doGetMoreData: storeId: http://cdn.krxd.net/controltag?confid=JA8mItOH
2016/07/23 00:30:35.172 kid1| 88,3| client_side_reply.cc(462) cacheHit: clientCacheHit: http://cdn.krxd.net/controltag?confid=JA8mItOH, 3918 bytes
2016/07/23 00:30:35.172 kid1| 88,2| client_side_reply.cc(511) cacheHit: clientProcessHit: Vary MATCH!
2016/07/23 00:30:35.173 kid1| 88,5| client_side_reply.cc(605) cacheHit: plain old HIT
2016/07/23 00:30:35.173 kid1| 88,5| client_side_reply.cc(2152) sendMoreData: clientReplyContext::sendMoreData: http://cdn.krxd.net/controltag?confid=JA8mItOH, 3918 bytes (3918 new bytes)
2016/07/23 00:30:35.173 kid1| 88,5| client_side_reply.cc(2156) sendMoreData: clientReplyContext::sendMoreData:local=192.192.192.212:3128 remote=10.4.4.60:1842 FD 15 flags=1 'http://cdn.krxd.net/controltag?confid=JA8mItOH' out.offset=0
2016/07/23 00:30:35.173 kid1| 88,2| client_side_reply.cc(1999) processReplyAccessResult: The reply for GET http://cdn.krxd.net/controltag?confid=JA8mItOH is ALLOWED, because it matched all
2016/07/23 00:30:35.173 kid1| 88,3| client_side_reply.cc(2037) processReplyAccessResult: clientReplyContext::sendMoreData: Appending 3101 bytes after 817 bytes of headers
2016/07/23 00:30:35.173 kid1| assertion failed: client_side_reply.cc:1091: "http->storeEntry()->objectLen() >= headers_sz"
2016/07/23 00:30:38 kid1| Starting Squid Cache version 3.5.19-20160524-r14057 for x86_64-pc-linux-gnu...

Alex Rousskov (rousskov) said : #4

> assertion failed: client_side_reply.cc:1091: "http->storeEntry()->objectLen() >= headers_sz"

This looks like a Squid bug to me. File a bug report with the Squid Project and post a backtrace trace from the latest v4 or v3 release there.

joe (joejoe) said : #5

hi alex i dont know if this is squid adaptation bug or ecap bug since the same object work wen i turn of ecap
 http://cdn.krxd.net/controltag?confid=JA8mItOH

wat happen is wen ecap is on and i use simple adapter nothing yet on start function just wat you suggest
to tell the host to use the virgin message the file hang wen i brows to it 60% of the file i can see on
the browser and ecap return object size nil i gess here squid assert and restart
my suggestion is ecap should signal squid to bypass the object and continue working not asserting making squid restart
this is not danger loop or mem leak to have assert any way
it look the krxd.net server has problem with something they fix it i can not re produce the bug
but there is easy solution to that if it happen in future
 in client_side_reply.cc
function clientReplyContext::storeOKTransferDone() const
replace those assert with just warning
    assert(http->storeEntry()->objectLen() >= 0);

    assert(http->storeEntry()->objectLen() >= headers_sz);

to
if (http->storeEntry()->objectLen() >= headers_sz || http->storeEntry()->objectLen() >= 0) {
    debugs(88,3,HERE << "storeOKTransferDone " <<
               " out.offset=" << http->out.offset <<
               " objectLen()=" << http->storeEntry()->objectLen() <<
               " headers_sz=" << headers_sz);
}

any way you can keep this as info for the future if it happen with someone else or you can tel the dev guys about it
i dont think i can explain it to them in right way they alwais ignore me lol spetial the link fixed so i cant re produce the err
thanks for your help alex