From owner-freebsd-hackers Sun Jul 14 8:50:11 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 15EF737B400 for ; Sun, 14 Jul 2002 08:50:07 -0700 (PDT) Received: from search.sparks.net (d-207-5-180-136.gwi.net [207.5.180.136]) by mx1.FreeBSD.org (Postfix) with ESMTP id A97BD43E72 for ; Sun, 14 Jul 2002 08:50:06 -0700 (PDT) (envelope-from dmiller@sparks.net) Received: by search.sparks.net (Postfix, from userid 100) id 34440D994; Sun, 14 Jul 2002 11:49:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by search.sparks.net (Postfix) with ESMTP id 1DDC5D993; Sun, 14 Jul 2002 11:49:46 -0400 (EDT) Date: Sun, 14 Jul 2002 11:49:46 -0400 (EDT) From: David Miller To: Luigi Rizzo Cc: hackers@FreeBSD.ORG Subject: Re: setsockopt() weirdness In-Reply-To: <20020714075706.A74633@iguana.icir.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 14 Jul 2002, Luigi Rizzo wrote: > On Sun, Jul 14, 2002 at 10:49:56AM -0400, David Miller wrote: > > I'm probably doing something basic wrong, but I'm getting a very > > inconsistent response when using setsockopt to set the SO_RCVTIMEO to > > seven seconds or more. > > i would suspect some overflow of 16-bit fields used to store > the timeout value (scaled by HZ) . > What value of "HZ" are you using ? And what is the exact threshold > where it fails (i'd bet it is between 6.5 and 6.6 sec.) ? I haven't tried to pin it down exactly. I can, if that would be happy to anyone else. HZ is set to 5000; the machine is intended to process several tens of thousands of very small packets per second, and interrupt processing was a big problem. Since receiving your message I recompiled the kernel with HZ=1000 and the problem occurs with 32 seconds working and 33 not, so I'm sure you're right with the bet of 6.5 and 6.6 seconds. Does this mean that if one left HZ alone at 100 that you could only set it for 320 seconds? There's no warning of this in the manpage for setsockopt; I naturally assumed that one could set an unsigned long delay and that it would work. Is this a bug, or just a feature I'm looking at sideways? On a different note, how could I have discovered this without asking the hackers list? Thanks, and thanks for your help luigi! --- David To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message