From owner-freebsd-stable@FreeBSD.ORG Wed Feb 24 12:41:07 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 55D4C106566B for ; Wed, 24 Feb 2010 12:41:07 +0000 (UTC) (envelope-from john.marshall@riverwillow.com.au) Received: from mail1.riverwillow.net.au (mail1.riverwillow.net.au [203.58.93.36]) by mx1.freebsd.org (Postfix) with ESMTP id C6C068FC17 for ; Wed, 24 Feb 2010 12:41:06 +0000 (UTC) Received: from rwpc12.mby.riverwillow.net.au (rwpc12.mby.riverwillow.net.au [172.25.24.168]) (authenticated bits=0) by mail1.riverwillow.net.au (8.14.4/8.14.4) with ESMTP id o1OCf2ZF031164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Feb 2010 23:41:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=riverwillow.com.au; s=m1001; t=1267015263; bh=DgUR3Dki9nZVqV/fYO7EfHaXqbeapXCPFxReTJzt7p0=; h=Date:From:To:Subject:Message-ID:References:Mime-Version: Content-Type:In-Reply-To; b=zuFnVM2rMgemDy2vGGw18ApM63jcu5KSGKrjV/PP7N7+r3PRnShii2MCRWX/FPcc0 LUCP5koQ/3yw2rUXjMHA9FkqMunEtc9L/SoqrsMgdbChQ4yhvgp+7mEFqxCHXYUzuo 6LLUdbQOI3s5KZycS+PSCb9xm5f8ysbH63X50rYo= Received: from rwpc12.mby.riverwillow.net.au (localhost [127.0.0.1]) by rwpc12.mby.riverwillow.net.au (8.14.3/8.14.3) with ESMTP id o1OCf1TT015783 for ; Wed, 24 Feb 2010 23:41:01 +1100 (AEDT) (envelope-from john.marshall@riverwillow.com.au) Received: (from john@localhost) by rwpc12.mby.riverwillow.net.au (8.14.3/8.14.3/Submit) id o1OCf1uI015782 for freebsd-stable@freebsd.org; Wed, 24 Feb 2010 23:41:01 +1100 (AEDT) (envelope-from john) Date: Wed, 24 Feb 2010 23:41:01 +1100 From: John Marshall To: freebsd-stable@freebsd.org Message-ID: <20100224124101.GC14464@rwpc12.mby.riverwillow.net.au> Mail-Followup-To: freebsd-stable@freebsd.org References: <20100223013522.GE2303@rwpc12.mby.riverwillow.net.au> <20100224075359.GA61876@server.vk2pj.dyndns.org> <20100224112139.GT50403@deviant.kiev.zoral.com.ua> <20100224114441.GA57760@icarus.home.lan> <20100224122045.GU50403@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rwEMma7ioTxnRzrJ" Content-Disposition: inline In-Reply-To: <20100224122045.GU50403@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i OpenPGP: id=A29A84A2; url=http://pki.riverwillow.net.au/pgp/johnmarshall.asc 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 12:41:07 -0000 --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, 24 Feb 2010, 14:20 +0200, Kostik Belousov wrote: > On Wed, Feb 24, 2010 at 03:44:41AM -0800, Jeremy Chadwick wrote: > > 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 sendmai= l, > > > > rather than the FreeBSD kernel. > > > >=20 > > > > On 2010-Feb-23 12:35:22 +1100, John Marshall wrote: > > > > >Environment: sendmail 8.14.4 on FreeBSD 8.0-RELEASE-p2 > > > >=20 > > > > Note that this is stock ISC sendmail, not the sendmail in either the > > > > base system or the port. > > > >=20 > > > > >I posted about this in comp.mail.sendmail and was told... > > > > > > > > > >> sleep() should be one of these calls: > > > > >>=20 > > > > >> if (njobs =3D=3D 0 && WorkGrp[wgrp].wg_lowqintvl < MIN_S= LEEP_TIME) > > > > >> sleep(MIN_SLEEP_TIME); > > > > >> else if (WorkGrp[wgrp].wg_lowqintvl <=3D 0) > > > > >> sleep(QueueIntvl > 0 ? QueueIntvl : MIN_SLEEP_TI= ME); > > > > >> else > > > > >> sleep(WorkGrp[wgrp].wg_lowqintvl); > > > >=20 > > > > 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() defin= ed > > > > in libsm/clock.c - which is a horrible maze of #ifdefs. > > > >=20 > > > > John has pre-processed that code and the result it at: > > > > http://www.riverwillow.net.au/~john/sm/clock.preprocessed > > > >=20 > > > > 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 a= nd > > > > before pause() is called - in which case, the signal is lost and > > > > pause() will sleep forever. > > > >=20 > > > > On 2010-Feb-24 08:13:06 +1100, John Marshall wrote: > > > > >My ktrace file was created with 'ktrace -g 48501'. I have the res= ult of > > > > >'kdump -R -p 48504' available at: > > > > > > > > > > > Regarding sigsuspend() returning EINTR without delivering any signal, > could it be that the sendmail process was debugged ? No. I didn't touch the process with anything this time. There was no debugger in use on the system. That was how I found the process first thing this morning so I sent off the kdump output. The process stayed in the same state until I rebooted the system this afternoon to install a kernel with debug symbols and options. I have done the same on the other two servers, so I can dig deeper for you next time. I am running ktrace on the sendmail process group on all three servers waiting to catch the next one. By the way, all three are i386 with SMP. --=20 John Marshall --rwEMma7ioTxnRzrJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkuFHl0ACgkQw/tAaKKahKJRdgCfRxvijTaEMlWR1EJxbQbAhio1 Ki8AnAs43Q+xKJLF00Eb6LFqodfUwQJe =xIJd -----END PGP SIGNATURE----- --rwEMma7ioTxnRzrJ--