From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 16 19:33:31 2007 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EC6516A419; Fri, 16 Nov 2007 19:33:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au [211.29.132.192]) by mx1.freebsd.org (Postfix) with ESMTP id 6A8C913C448; Fri, 16 Nov 2007 19:33:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-219-213.carlnfd3.nsw.optusnet.com.au (c211-30-219-213.carlnfd3.nsw.optusnet.com.au [211.30.219.213]) by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id lAGIW2H0013660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Nov 2007 05:32:05 +1100 Date: Sat, 17 Nov 2007 05:32:02 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: kmacy@freebsd.org In-Reply-To: <200711160704.lAG747xf087203@freefall.freebsd.org> Message-ID: <20071117045951.O65178@delplex.bde.org> References: <200711160704.lAG747xf087203@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: enache@rdslink.ro, freebsd-bugs@freebsd.org, bde@freebsd.org Subject: Re: kern/46036: inaccurate timeouts in select(),nanosleep() + fix X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2007 19:33:31 -0000 On Fri, 16 Nov 2007 kmacy@freebsd.org wrote: > Synopsis: inaccurate timeouts in select(),nanosleep() + fix > > State-Changed-From-To: open->feedback > State-Changed-By: kmacy > State-Changed-When: Fri Nov 16 07:03:16 UTC 2007 > State-Changed-Why: > > Please comment on whether or not this is in fact a bug and then throw back in to the pool. > Thanks. There are a lot of different, tiny bugs in this area. I still think that the behaviour of select() is correct -- select() must sleep for at least the specified time, and if it only returns for timeouts then it is in sync with the timeout clock so it must sleep for almost a full extra tick on the next call to ensure sleeping for long enough. In some other cases and syscalls, the extra tick can be avoided by waking up 1 tick earlier and checking if the timeout has expired and going back to sleep if it has not. The PR followup has details of the other cases. I don't have time to check these now or plans to work on them. I would mark the PR as suspended. This behaviour makes select() unsuitable for implementing a periodic timeout. If you want a periodic timeout, then use setitimer(2). I did this for netstat(1) and have thought of doing it in ping(8). THe problem is smaller with HZ = 1000, but I use HZ = 100. > Responsible-Changed-From-To: freebsd-bugs->bde > Responsible-Changed-By: kmacy > Responsible-Changed-When: Fri Nov 16 07:03:16 UTC 2007 > Responsible-Changed-Why: > > Please comment on whether or not this is in fact a bug and then throw back in to the pool. > Thanks. Gnats sent 2 copies of the message (one for each change of From-To). In some other recent gnats mail, gnats seems to just not send 1 of 2 different messages. Bruce