problems with squid and shift-reload in netscape

From: Jon Piesing <>
Date: Thu, 12 Sep 1996 17:46:55 +0100 (BST)

Dear all,

I sent an email to this list about a month ago concerning the shift-reload
feature in netscape not working with my squid server (1.0.10) once I added
any neighbors. I am getting error messages like this in my cache.log file :-

[12/Sep/1996:11:51:12 +0100] proto.c:591: protoCantFetchObject: FD 5 No neighbors or parents were queried and the host is beyond your firewall.

I've been examining the source code to try and work out what's happening
here and I think I've found what causes shift-reload to break. I'm just
not sure of a good way to fix it.

In squid.conf, I have one parent and one neighbor ..

cache_host parent 80 7 no-query
cache_host prsun11b neighbor 80 3130

I have removed all acl directives I had added beyond the default.

The relevant logic to this problem seems to be mostly in the function
protoDispatchDNSHandle() in proto.c.

In the case where there are no neighbors, this if statement evaluates to
true and handles things correctly ...

    if ((e = protoData->single_parent) &&
        (single_parent_bypass || protoData->direct_fetch == DIRECT_NO)) {

Once I add a neighbor, the difference between normal page access and
shift-reload seems to be due to the following if statement in neighborsUdpPing()
(in neighbors.c) which is called by protoDispatchDNSHandle() :-

        /* Don't resolve refreshes through neighbors because we don't resolve
         * misses through neighbors */
       if (e->type == EDGE_SIBLING && entry->flag & REFRESH_REQUEST)

In the normal case, protoDispatchDNSHandle() calls neighborsUdpPing(),
the above if statement is false and the solitary neighbor is pinged. Once all
results come back negative, the page is fetched from the parent by
getFromDefaultSource(). In this normal case, neighborsUdpPing() returns 1 to
protoDispatchDNSHandle() (=count of neighbors pinged) and
protoDispatchDNSHandle() returns ignoring the rest of that function.

In the shift-reload case, no neighbors are pinged due to the second if
statement above and the rest of protoDispatchDNSHandle() is executed instead
of getFromDefaultSource() and makes no attempt to load from a parent.

Commenting out the if statement does make shift-reload work. Clearly this
isn't the right fix for the problem.

One option would be to add more code to the end of protoDispatchDNSHandle()
to match getFromDefaultSource(). I'm not confident that I understand this
function well enough to add this code myself.

Another option would be to change the function getSingleParent() used to
compute protoData->single_parent used in the first if statement above so
that that first if statement evaluates to true and the same code is used
to handle the request as in the neighbor-less case.

The current code in getSingleParent() to implement this is below :-

            if (e->type != EDGE_PARENT) {
                /* we matched a neighbor, not a parent. There
                 * can be no single parent */
                if (n == NULL)
                    return NULL;

Changing the contents of this if statement so that it only contains continue
and moving the 'count++' after the if also fixes the problem. This last fix
feels cleaner than the other two but I don't understand the code well enough
to say which (if any) of them are right.

Can somebody more familiar with the code suggest a proper fix for this
problem ?


Received on Thu Sep 12 1996 - 09:47:03 MDT

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