Subject: Re: squid now reveals a new kernel problem.
To: None <tech-kern@netbsd.org,>
From: Greg A. Woods <woods@most.weird.com>
List: tech-net
Date: 10/28/1999 22:05:25
[ On Friday, October 29, 1999 at 09:53:59 (+1000), Darren Reed wrote: ]
> Subject: Re: squid now reveals a new kernel problem.
>
> btw, whilst our changes are clearly (to you) insufficient/incorrect,
> they did survive testing (to some extent) by both of us.  Given that
> I discussed this problem before patching (I'm not sure if I posted
> the patch to tech-kern), the correct calling of routines can't be
> that obvious if you didn't pickup the problem then and neither did
> anyone else.  (Had I the time right now, I'd verify what I actually
> sent to tech-kern regarding this matter.)  Personally, I'd like to
> thnk Greg for testing it in a scenario where correct operation is
> required, leading to the discovery of the problem.

You're most welcome.  Lack of testing was the reason I never did
anything about this issue way back when I first suspected it after
reading the code and then again after reviewing it and the explanations
in Stevens' book.  I didn't have any idea how to go about testing it.
It just so happens that the busy squid server I'm supporting has proven
to be an almost ideal testing ground (it would be better if there were a
sibling cache and a smart enough router to detect downtime and
automatically bybass the dead cache! ;-).  Even so this error condition
only occurs in about one in every 25,000 connections or so.  We thought
we had found a particularly misbehaved client that triggered it more
often, but it doesn't seem to be the case on closer examination.

I can now report that with the addition of one more line of code as
Charles hinted, the shutdown and log rotation now works without
complaint.  That additional line of code changes the cleanup to look
more like this:

	/*
	 * if an error occured, remove the file descriptor from the
	 * process' open file table and then free it.
	 */
	if (error) {
		p->p_fd->fd_ofiles[tmpfd] = 0;
		ffree(fp);
	}

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>