From owner-freebsd-current@FreeBSD.ORG Mon Jun 16 00:39:32 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4593037B405; Mon, 16 Jun 2003 00:39:32 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64BDF43F3F; Mon, 16 Jun 2003 00:39:31 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9/8.12.9) with ESMTP id h5G7dMM7048200; Mon, 16 Jun 2003 00:39:26 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200306160739.h5G7dMM7048200@gw.catspoiler.org> Date: Mon, 16 Jun 2003 00:39:22 -0700 (PDT) From: Don Lewis To: tjr@FreeBSD.org In-Reply-To: <20030616163701.A56231@dilbert.robbins.dropbear.id.au> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: current@FreeBSD.org Subject: Re: qmail uses 100% cpu after FreeBSD-5.0 to 5.1 upgrade X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2003 07:39:32 -0000 On 16 Jun, Tim Robbins wrote: > On Mon, Jun 16, 2003 at 04:09:51PM +1000, Tim Robbins wrote: > >> On Sun, Jun 15, 2003 at 08:43:15PM -0400, Chris Shenton wrote: >> >> > I've been running qmail for years and like it, installed pretty much >> > per www.LifeWithQmail.org. My main system was running FreeBSD >> > 5.0-RELEASE and -CURRENT and qmail was fine. When I just upgraded to >> > 5.1-CURRENT a couple days back, the qmail-send process started using >> > all CPU. >> >> This looks like a bug in the named pipe code. Reverting >> sys/fs/fifofs/fifo_vnops.c to the RELENG_5_0 version makes the problem go >> away. I haven't tracked down exactly what change between RELENG_5_0 and >> RELENG_5_1 caused the problem. > > Looks like revision 1.86 works, but it stops working with 1.87. Moving the > soclose() calls to fifo_inactive() may have caused it. This is an interesting observation, but I'm not sure why it would make a difference. I haven't looked at the qmail source, but it looks like it is doing a non-blocking open on the fifo, calling select() on the fd, and hoping that select() waits for a writer to open the fifo before returning with an indication that the descriptor is readable. It looks like the select code is calling the soreadable() macro to determine if the fifo descriptor is readable, and the soreadable() macro returns a true value if the SS_CANTRCVMORE socket flag is set, which would indicate an EOF condition. I might believe that I accidentally changed the setting of this flag, but I just compared fifo_vnops.c rev 1.78 with 1.87 and I believe this flag should be set the same way in both versions. In both versions, fifo_close() always calls socantrcvmore(), which sets SS_CANTRCVMORE when the writer count drops to zero. Prior to 1.87, fifo_close() also destroyed the sockets when the reference count dropped to zero, which caused fifo_open() to recreate the sockets when the fifo was opened again, and when it did, fifo_open() set the SS_CANTRCVMORE flag again. The posted qmail syscall trace looks like what I would expect to see in the present implementation. I can't explain why it would behave any differently prior to 1.87 ...