From owner-freebsd-stable@FreeBSD.ORG Wed Feb 24 11:44:43 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CA5F1065679 for ; Wed, 24 Feb 2010 11:44:43 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta12.emeryville.ca.mail.comcast.net (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227]) by mx1.freebsd.org (Postfix) with ESMTP id F2C688FC0A for ; Wed, 24 Feb 2010 11:44:42 +0000 (UTC) Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta12.emeryville.ca.mail.comcast.net with comcast id lnfa1d0011Y3wxoACnkjF2; Wed, 24 Feb 2010 11:44:43 +0000 Received: from koitsu.dyndns.org ([98.248.46.159]) by omta15.emeryville.ca.mail.comcast.net with comcast id lnki1d0033S48mS8bnkiGA; Wed, 24 Feb 2010 11:44:43 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 30C9E1E301A; Wed, 24 Feb 2010 03:44:41 -0800 (PST) Date: Wed, 24 Feb 2010 03:44:41 -0800 From: Jeremy Chadwick To: freebsd-stable@freebsd.org Message-ID: <20100224114441.GA57760@icarus.home.lan> References: <20100223013522.GE2303@rwpc12.mby.riverwillow.net.au> <20100224075359.GA61876@server.vk2pj.dyndns.org> <20100224112139.GT50403@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100224112139.GT50403@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: sleep(3) sometimes too sleepy on FreeBSD 8.0? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 11:44:43 -0000 On Wed, Feb 24, 2010 at 01:21:39PM +0200, Kostik Belousov wrote: > On Wed, Feb 24, 2010 at 06:53:59PM +1100, Peter Jeremy wrote: > > Updates following some off-line discussions and debugging with John on > > IRC. I've cc'd gshapiro@ because the problem appears to be sendmail, > > rather than the FreeBSD kernel. > > > > On 2010-Feb-23 12:35:22 +1100, John Marshall wrote: > > >Environment: sendmail 8.14.4 on FreeBSD 8.0-RELEASE-p2 > > > > Note that this is stock ISC sendmail, not the sendmail in either the > > base system or the port. > > > > >I posted about this in comp.mail.sendmail and was told... > > > > > >> sleep() should be one of these calls: > > >> > > >> if (njobs == 0 && WorkGrp[wgrp].wg_lowqintvl < MIN_SLEEP_TIME) > > >> sleep(MIN_SLEEP_TIME); > > >> else if (WorkGrp[wgrp].wg_lowqintvl <= 0) > > >> sleep(QueueIntvl > 0 ? QueueIntvl : MIN_SLEEP_TIME); > > >> else > > >> sleep(WorkGrp[wgrp].wg_lowqintvl); > > > > Whilst it's true that the code calls sleep(), it's not calling > > sleep(3) in the FreeBSD libc. Instead it's calling a sleep() defined > > in libsm/clock.c - which is a horrible maze of #ifdefs. > > > > John has pre-processed that code and the result it at: > > http://www.riverwillow.net.au/~john/sm/clock.preprocessed > > > > At a quick look, the code is broken: sm_seteventm() generates a > > one-off timer using setitimer(2), which will send SIGALRM when it > > expires. sm_releasesignal() then unblocks SIGALRM. In theory, the > > SIGALRM could be delivered anywhere after the (!SmSleepDone) test and > > before pause() is called - in which case, the signal is lost and > > pause() will sleep forever. > > > > On 2010-Feb-24 08:13:06 +1100, John Marshall wrote: > > >My ktrace file was created with 'ktrace -g 48501'. I have the result of > > >'kdump -R -p 48504' available at: > > > > > > > I get 'kdump: data too short' on RELENG_8/i386. Is the OP's machine amd64? -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |