From owner-freebsd-stable@FreeBSD.ORG Wed Feb 24 11:21:49 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 4A7A0106564A; Wed, 24 Feb 2010 11:21:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CF7F18FC1A; Wed, 24 Feb 2010 11:21:48 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o1OBLdcU076731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Feb 2010 13:21:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id o1OBLdhY089561; Wed, 24 Feb 2010 13:21:39 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id o1OBLdcO089560; Wed, 24 Feb 2010 13:21:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Feb 2010 13:21:39 +0200 From: Kostik Belousov To: Peter Jeremy Message-ID: <20100224112139.GT50403@deviant.kiev.zoral.com.ua> References: <20100223013522.GE2303@rwpc12.mby.riverwillow.net.au> <20100224075359.GA61876@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EvPGq5x6n2a0k3dQ" Content-Disposition: inline In-Reply-To: <20100224075359.GA61876@server.vk2pj.dyndns.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: gshapiro@freebsd.org, freebsd-stable@freebsd.org 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:21:49 -0000 --EvPGq5x6n2a0k3dQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=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_SLEEP_T= IME) > >> sleep(MIN_SLEEP_TIME); > >> else if (WorkGrp[wgrp].wg_lowqintvl <=3D 0) > >> sleep(QueueIntvl > 0 ? QueueIntvl : MIN_SLEEP_TIME); > >> 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() defined > 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 and > 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 result of > >'kdump -R -p 48504' available at: > > > > I get 'kdump: data too short' on RELENG_8/i386. >=20 > The syscall pattern near the end of this file is significantly different > from that elsewhere in the file - with gettimeofday(), sigprocmask() and > sigsuspend() looping fairly rapidly. Interestingly, sigsuspend() is > returning EINTR but no signal is reported. I'm not sure what could > cause this. Is this 8.0-RELEASE ? Please note that kern_sigsuspend() code was changed in HEAD/RELENG_8 after 8.0 release. >=20 > This syscall pattern looks like the while() loop in sendmail's sleep(), > though it does appear that the loop is exited on that occasion but not > on the following occasion (though the reason for this behaviour is > unclear). --EvPGq5x6n2a0k3dQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkuFC8MACgkQC3+MBN1Mb4hengCg3jU3kelZFdq/8eNvLWvMgqjf uLAAn3ras5iou1NHpL5OPQzsI0Tic828 =DrdN -----END PGP SIGNATURE----- --EvPGq5x6n2a0k3dQ--