Squid logging bug fix (fwd)

From: Duane Wessels <wessels@dont-contact.us>
Date: Tue, 01 Sep 1998 16:07:09 -0600

Forwarded for John Dilley, who has problems posting to squid-users
because of requirement limiting postings to list members.

------- Forwarded Message

To: squid-users@ircache.net
Subject: Re: Squid logging bug fix
Date: Fri, 21 Aug 1998 18:06:30 -0700
From: John Dilley <jad@pimlico.hpl.hp.com>

Squid-users,

        Enclosed below is information on a defect found and fixed by our
summer student, Godfrey Tan from UCB, in the Squid 1.1.20 and 1.2.beta22
releases. The fix was implemented and tested in both versions on HP-UX.
If you are interested in examining the store.log file to understand
Squid's cache replacement decisions you might want to apply the fix.
It is quite simple.

        Godfrey is heading back to school; if there are any followup
questions or comments, just drop me a line. Regards,

                             -- jad --
                          John Dilley <jad@hpl.hp.com>

/*
 * A Bug Fix to the storeLog Function of Squid
 * Godfrey Tan
 * @GT
 */

        In both versions of Squid, 1.2.20 and 1.2.beta22, the storeLog
method failed to record the information of released objects properly. An
object released by the storeRelease method was recorded in store.log
only if the object had not been purged from memory. In case the object
was purged from the memory (storePurgeMem) before storeRelease was
called, "mem" field of the storeEntry structure of that object would be
set to NULL. As a result, the storeLog function would not record any
information since it required information from "mem" field of the
storeEntry structure. A fix was made to the storeLog function in both
versions of Squid. The correctness of the bug fix was only verified in
Squid 1.1.20 (in Squid 1.2.beta22 the swap.log file is binary but the
store.log looked correct).

A Fix to Squid 1.1.20
        The following code must be added to "storeLog" in store.c.

if (mem == NULL) { /* Line 462 in the original copy of store.c. */
        if (tag == STORE_LOG_RELEASE) { /* BUG_FIX */
                sprintf(logmsg, "%9d.%03d %-7s %4d %9d %9d %9d %s %d/%d %s %s\n
",
                 (int) current_time.tv_sec,
                (int) current_time.tv_usec / 1000,
                storeLogTags[tag],
                -1,
                 -1,
                 -1,
                 -1,
                 "unknown_content_type",
                -1,
                -1,
                RequestMethodStr[e->method],
                 e->url);
                file_write(storelog_fd,
                xstrdup(logmsg),
                 strlen(logmsg),
                 NULL,
                 NULL,
                 xfree); /* End of BUG_FIX */
        }
        return;
}

A Fix to Squid 1.2.beta22
        The following code must be added to "storeLog" in store_log.c.

if (mem == NULL) { /* Line 22 in the original copy of store_log.c. */
               if (tag == STORE_LOG_RELEASE) { /*BUG_FIX */
                 memBufDefInit(&mb);
                 memBufPrintf(&mb, "%9d.%03d %-7s %08X %4d %9d %9d %9d %s %d/%d
%s %s\n",
                      (int) current_time.tv_sec,
                      (int) current_time.tv_usec / 1000,
                      storeLogTags[tag],
                      e->swap_file_number,
                      -1,
                      -1,
                      -1,
                      -1,
                      "unknown_content_type",
                      -1,
                      -1,
                      "unknown_method",
                      "unknown_url");
                 file_write_mbuf(storelog_fd, -1, mb, NULL, NULL);
               }
        return;
}

------- End of Forwarded Message
Received on Tue Sep 01 1998 - 15:08:19 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:41:49 MST