ICAP- Assertion failed: store.c:523: "e->store_status == STORE_PENDING"

From: Christos Tsantilas <chtsanti@dont-contact.us>
Date: Fri, 22 Oct 2004 13:15:12 +0300

When icap server responds with "204 No Content"
the squid frequently die with message:
 
2004/10/21 15:26:11| assertion failed: store.c:523: "e->store_status == STORE_PENDING"

Olivier informed me that he has the same problem when he try to apply the patch that
I sent to mailing list with message (http://www.mail-archive.com/squid-dev@squid-cache.org/msg02062.html)

I think, this happens only when http server closes the connection after sending the web page or file,
and there is no "Content-Length" header in http server responce. The http server in this case mark the end
of file closing the connection. Squid marks the coresponding StoreEntry "ENTRY_ABORTED" but the icap client
try to write new data on it (Q:new arrived data or old not reseted data?).

In file icap_respmod.c at the last lines of function icapReadReply2 (line 885 in my icap_respmod.c file)
someone can change the block:

...
if (icap->flags.no_content) {
        /* data from http.c is not chunked */
        debug(81, 3) ("copying %d bytes from chunk_buf to entry\n",
            icap->chunk_buf.size);
        storeAppend(entry, icap->chunk_buf.buf, icap->chunk_buf.size);
        icap->chunk_buf.size = 0;
    } else if (2 == icapHttpReplyHdrState(icap)) {
        if (icap->chunk_buf.size)
            icapParseChunkedBody(icap, storeAppend, entry);
    }
    icapReadReply3(icap);
    return 0;
}

to:
....
if (icap->flags.no_content ) {
        /* data from http.c is not chunked */
        if(!EBIT_TEST(entry->flags, ENTRY_ABORTED)){
             debug(81, 3) ("copying %d bytes from chunk_buf to entry\n",
                icap->chunk_buf.size);
             storeAppend(entry, icap->chunk_buf.buf, icap->chunk_buf.size);
             icap->chunk_buf.size = 0;
        }
    } else if (2 == icapHttpReplyHdrState(icap)) {
        if (icap->chunk_buf.size)
            icapParseChunkedBody(icap, storeAppend, entry);
    }
    icapReadReply3(icap);
    return 0;
}

----------------------------------------------

 Regards,
        Christos
Received on Fri Oct 22 2004 - 08:41:30 MDT

This archive was generated by hypermail pre-2.1.9 : Sun Oct 31 2004 - 12:00:02 MST