Re: Squid-ICAP problem (bug?)

From: Christophe Boyanique <tof+squid@dont-contact.us>
Date: Tue, 14 Nov 2006 14:20:10 +0100

Hello,

Thanks for you support.

I tried the patch from Tsantilas:

if (icap->chunk_size < 0)
        icap->flags.reqmod_http_entity_eof = 1;

instead of:

if (icap->reqmod.http_entity.bytes_read >= icap->request->content_length)
        icap->flags.reqmod_http_entity_eof = 1;

And that corrects the initial problem: remaining data waiting on the
wire is read ("\r\n0\r\n").

But there is a new problem.

After the conditionnal call to commSetSelect there is a conditionnal
call to icapReqModPassHttpBody and this where is the problem:

     if (icap->reqmod.http_entity.callback &&
icap->reqmod.http_entity.buf.size) {
         icapReqModPassHttpBody(icap,
             icap->reqmod.http_entity.callback_buf,
             icap->reqmod.http_entity.callback_bufsize,
             icap->reqmod.http_entity.callback,
             icap->reqmod.http_entity.callback_data);
         icap->reqmod.http_entity.callback = NULL;
         cbdataUnlock(icap->reqmod.http_entity.callback_data);

     }

When calling this function, the test is on
icap->reqmod.http_entity.buf.size but the parameter sent to the function
is cap->reqmod.http_entity.callback_bufsize. Is it normal ?

I added some logs and here is the output:

2006/11/14 13:43:25| icapReqModReadHttpBody: FD 38 called
2006/11/14 13:43:25| icapReqModReadHttpBody: read returns 33
2006/11/14 13:43:25| icap_common.c:695: chunk_size=0
2006/11/14 13:43:25| icap_common.c:702: bufOffset=0, len=33
2006/11/14 13:43:25| icap_common.c:705: bufOffset=0, len=33
2006/11/14 13:43:25| icapParseChunkSize: buf=0x9e362d0, len=33
2006/11/14 13:43:25| icapParseChunkSize: start=0
2006/11/14 13:43:25| icapLineLength: returning 4
2006/11/14 13:43:25| icapParseChunkSize: start=0, end=2
2006/11/14 13:43:25| icapParseChunkSize: return nextStart=4
2006/11/14 13:43:25| got chunksize 27, new offset 4
2006/11/14 13:43:25| icap_common.c:723: X
2006/11/14 13:43:25| icap_common.c:705: bufOffset=31, len=33
2006/11/14 13:43:25| icapParseChunkSize: buf=0x9e362ef, len=2
2006/11/14 13:43:25| icapParseChunkSize: start=0
2006/11/14 13:43:25| icapLineLength: returning 2
2006/11/14 13:43:25| icapParseChunkSize: start=2
2006/11/14 13:43:25| icap_reqmod.c:882 chunk_size=0
2006/11/14 13:43:25| icap_reqmod.c:892 http_entity.callback=(nil)
2006/11/14 13:43:25| icap_reqmod.c:894 http_entity.buf.size=27
2006/11/14 13:43:25| icap_reqmod.c:896 http_entity.callback_bufsize=0
2006/11/14 13:43:25| icapService: type=ICAP_SERVICE_REQMOD_POSTCACHE
2006/11/14 13:43:25| icapService: checking service service_3/id=0
2006/11/14 13:43:25| icapService: checking service service_4/id=0
2006/11/14 13:43:25| icapService: no service found
2006/11/14 13:43:25| icapReqModPassHttpBody: called
2006/11/14 13:43:25| icapReqModPassHttpBody: entity buf size = 27
2006/11/14 13:43:25| icapReqModPassHttpBody: giving 27 bytes to other side
2006/11/14 13:43:25| icapReqModPassHttpBody: entity buf size now = 0
2006/11/14 13:43:25| icapReqModPassHttpBody: called
2006/11/14 13:43:25| icapReqModPassHttpBody: entity buf size = 0
2006/11/14 13:43:25| icapReqModReadHttpBody: FD 38 called
2006/11/14 13:43:25| icapReqModReadHttpBody: read returns 5
2006/11/14 13:43:25| icap_common.c:695: chunk_size=0
2006/11/14 13:43:25| icap_common.c:702: bufOffset=0, len=7
2006/11/14 13:43:25| icap_common.c:705: bufOffset=0, len=7
2006/11/14 13:43:25| icapParseChunkSize: buf=0x9e362d0, len=7
2006/11/14 13:43:25| icapParseChunkSize: start=0
2006/11/14 13:43:25| icapLineLength: returning 2
2006/11/14 13:43:25| icapParseChunkSize: start=2
2006/11/14 13:43:25| icapLineLength: returning 3
2006/11/14 13:43:25| icapParseChunkSize: start=2, end=3
2006/11/14 13:43:25| icapParseChunkSize: return nextStart=5
2006/11/14 13:43:25| got chunksize -2, new offset 5
2006/11/14 13:43:25| zero end chunk reached
2006/11/14 13:43:25| icap_reqmod.c:882 chunk_size=-2
2006/11/14 13:43:25| icap_reqmod.c:892 http_entity.callback=0x807c994
2006/11/14 13:43:25| icap_reqmod.c:894 http_entity.buf.size=0
2006/11/14 13:43:25| icap_reqmod.c:896 http_entity.callback_bufsize=8192
2006/11/14 13:43:25| icapReqModPassHttpBody: called
FATAL: Received Segment Violation...dying.

Perhaps there is a problem with parameters passed to
icapReqModPassHttpBody ?

Christophe.
Received on Tue Nov 14 2006 - 06:20:21 MST

This archive was generated by hypermail pre-2.1.9 : Wed Nov 29 2006 - 12:00:05 MST