Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2015 18:40:50 +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:  <1421433650372.44369@netapp.com>
In-Reply-To: <CAJ-VmomJ0GnHTK9NuKnJ3iLht6XbabKZV-2KKnu3i%2BuABrN8iQ@mail.gmail.com>
References:  <1421339375968.94209@netapp.com> <CAJ-VmonYaAUior3aGBioVUvMPM1OMHJnHt7-rQgzMGQ4co4ATQ@mail.gmail.com> <1421428048190.48193@netapp.com>, <CAJ-VmomJ0GnHTK9NuKnJ3iLht6XbabKZV-2KKnu3i%2BuABrN8iQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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.

Thanks for the help!
Ryan
________________________________________
From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian Chadd <adrian@freebsd.org>
Sent: Friday, January 16, 2015 1:39 PM
To: Quattlebaum, Ryan
Cc: freebsd-net@freebsd.org
Subject: Re: Accessing socket APIs soon after accept

Oh, I've no idea about -8. If that's what the code does then yeah,
that seems wrong. Is it like that in -10 or -11 ?



-adrian


On 16 January 2015 at 09:07, Quattlebaum, Ryan
<Ryan.Quattlebaum@netapp.com> wrote:
> Hi, Adrian. Thanks for taking a look at this.
>
> We're using FreeBSD 8.2 and httpd-2.4.10 with arp-1.5.1 and apr-util-1.5.4.
>
> The problem we're seeing is pretty intermittent, so I hope this test case can                                      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.
>
> 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 application to accept after the call to sonewconn returns, but the address information isn't set until further down in the function. Wouldn't this open a window where an application could accept on a socket that the syncache code isn't done configuring?
>
> - Ryan Quattlebaum
> ________________________________________
> From: adrian.chadd@gmail.com <adrian.chadd@gmail.com> on behalf of Adrian Chadd <adrian@freebsd.org>
> Sent: Thursday, January 15, 2015 1:20 PM
> To: Quattlebaum, Ryan
> Cc: freebsd-net@freebsd.org
> Subject: Re: Accessing socket APIs soon after accept
>
> On 15 January 2015 at 08:29, Quattlebaum, Ryan
> <Ryan.Quattlebaum@netapp.com> wrote:
>> Is there anything preventing applications from calling functions e.g. getsockname() right after accept()? Or is there a recommended pattern that applications should use to ensure they get correct data? We recently upgraded to a new version of Apache and are seeing uninitialized data coming back from a few of these calls.
>
> I'm under the impression that once you get the FD from accept(), it
> should be fully formed and ready.
>
> Which version of FreeBSD/apache is it? can you come up with a test
> case that shows that it's happening?
>
>
>
> -adrian
>
>> Thanks,
>>
>> Ryan Quattlebaum
>> Software Developer, NetApp, Inc.
>> _______________________________________________
>> freebsd-net@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-net
>> 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?1421433650372.44369>