From owner-freebsd-net@FreeBSD.ORG Fri Jan 16 18:46:03 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2690F33A; Fri, 16 Jan 2015 18:46:03 +0000 (UTC) Received: from mx144.netapp.com (mx144.netapp.com [216.240.21.25]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mx144.netapp.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9937D44; Fri, 16 Jan 2015 18:46:01 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.09,412,1418112000"; d="scan'208";a="12832173" Received: from hioexcmbx07-prd.hq.netapp.com ([10.122.105.40]) by mx144-out.netapp.com with ESMTP; 16 Jan 2015 10:40:51 -0800 Received: from HIOEXCMBX02-PRD.hq.netapp.com (10.122.105.35) by hioexcmbx07-prd.hq.netapp.com (10.122.105.40) with Microsoft SMTP Server (TLS) id 15.0.995.29; Fri, 16 Jan 2015 10:40:50 -0800 Received: from HIOEXCMBX02-PRD.hq.netapp.com ([::1]) by hioexcmbx02-prd.hq.netapp.com ([fe80::906c:fcf4:e0a8:9f81%21]) with mapi id 15.00.0995.031; Fri, 16 Jan 2015 10:40:50 -0800 From: "Quattlebaum, Ryan" To: Adrian Chadd Subject: RE: Accessing socket APIs soon after accept Thread-Topic: Accessing socket APIs soon after accept Thread-Index: AQHQMN+s1D+Mgs6QWka0EkIfHwtzNpzCBCMAgAD35iGAAJ/ggP//efwy Date: Fri, 16 Jan 2015 18:40:50 +0000 Message-ID: <1421433650372.44369@netapp.com> References: <1421339375968.94209@netapp.com> <1421428048190.48193@netapp.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.122.56.79] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2015 18:46:03 -0000 I haven't checked head of line. I'll go take a look. We are in the process = of moving to 9.x, so I'll check that as well.=0A= =0A= Thanks for the help!=0A= Ryan=0A= ________________________________________=0A= From: adrian.chadd@gmail.com on behalf of Adrian C= hadd =0A= Sent: Friday, January 16, 2015 1:39 PM=0A= To: Quattlebaum, Ryan=0A= Cc: freebsd-net@freebsd.org=0A= Subject: Re: Accessing socket APIs soon after accept=0A= =0A= Oh, I've no idea about -8. If that's what the code does then yeah,=0A= that seems wrong. Is it like that in -10 or -11 ?=0A= =0A= =0A= =0A= -adrian=0A= =0A= =0A= On 16 January 2015 at 09:07, Quattlebaum, Ryan=0A= wrote:=0A= > Hi, Adrian. Thanks for taking a look at this.=0A= >=0A= > We're using FreeBSD 8.2 and httpd-2.4.10 with arp-1.5.1 and apr-util-1.5.= 4.=0A= >=0A= > The problem we're seeing is pretty intermittent, so I hope this test case= can shine a little bit of light on th= e problem. We tried debugging this on our own by adding calls to getsocknam= e() right after the accept call (in srclib/apr/network_io/unix/sockets.c: a= pr_socket_accept()) and logging the output. That's where we saw invalid dat= a.=0A= >=0A= > I took a look at the source code for the TCP syncache module and the acce= pt syscall. It looks like the new child socket is available for the applica= tion to accept after the call to sonewconn returns, but the address informa= tion isn't set until further down in the function. Wouldn't this open a win= dow where an application could accept on a socket that the syncache code is= n't done configuring?=0A= >=0A= > - Ryan Quattlebaum=0A= > ________________________________________=0A= > From: adrian.chadd@gmail.com on behalf of Adrian= Chadd =0A= > Sent: Thursday, January 15, 2015 1:20 PM=0A= > To: Quattlebaum, Ryan=0A= > Cc: freebsd-net@freebsd.org=0A= > Subject: Re: Accessing socket APIs soon after accept=0A= >=0A= > On 15 January 2015 at 08:29, Quattlebaum, Ryan=0A= > wrote:=0A= >> Is there anything preventing applications from calling functions e.g. ge= tsockname() right after accept()? Or is there a recommended pattern that ap= plications should use to ensure they get correct data? We recently upgraded= to a new version of Apache and are seeing uninitialized data coming back f= rom a few of these calls.=0A= >=0A= > I'm under the impression that once you get the FD from accept(), it=0A= > should be fully formed and ready.=0A= >=0A= > Which version of FreeBSD/apache is it? can you come up with a test=0A= > case that shows that it's happening?=0A= >=0A= >=0A= >=0A= > -adrian=0A= >=0A= >> Thanks,=0A= >>=0A= >> Ryan Quattlebaum=0A= >> Software Developer, NetApp, Inc.=0A= >> _______________________________________________=0A= >> freebsd-net@freebsd.org mailing list=0A= >> http://lists.freebsd.org/mailman/listinfo/freebsd-net=0A= >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"= =0A=