Date: Fri, 16 Jan 2015 17:07:28 +0000 From: "Quattlebaum, Ryan" <Ryan.Quattlebaum@netapp.com> To: Adrian Chadd <adrian@freebsd.org> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: RE: Accessing socket APIs soon after accept Message-ID: <1421428048190.48193@netapp.com> In-Reply-To: <CAJ-VmonYaAUior3aGBioVUvMPM1OMHJnHt7-rQgzMGQ4co4ATQ@mail.gmail.com> References: <1421339375968.94209@netapp.com>, <CAJ-VmonYaAUior3aGBioVUvMPM1OMHJnHt7-rQgzMGQ4co4ATQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 c= an shine a little bit of light on the = problem. We tried debugging this on our own by adding calls to getsockname(= ) right after the accept call (in srclib/apr/network_io/unix/sockets.c: apr= _socket_accept()) and logging the output. That's where we saw invalid data.= =0A= =0A= I took a look at the source code for the TCP syncache module and the accept= syscall. It looks like the new child socket is available for the applicati= on to accept after the call to sonewconn returns, but the address informati= on isn't set until further down in the function. Wouldn't this open a windo= w where an application could accept on a socket that the syncache code isn'= t done configuring?=0A= =0A= - Ryan Quattlebaum=0A= ________________________________________=0A= From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian C= hadd <adrian@freebsd.org>=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= <Ryan.Quattlebaum@netapp.com> wrote:=0A= > Is there anything preventing applications from calling functions e.g. get= sockname() right after accept()? Or is there a recommended pattern that app= lications should use to ensure they get correct data? We recently upgraded = to a new version of Apache and are seeing uninitialized data coming back fr= om 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"=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1421428048190.48193>