Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2005 15:01:25 -0600
From:      Greg Lewis <glewis@eyesbeyond.com>
To:        Landon Fuller <landonf@threerings.net>
Cc:        freebsd-java@freebsd.org
Subject:   Re: [PATCH] jdk1.4.2, getsockname(), and ECONNRESET
Message-ID:  <20050621210125.GA96069@misty.eyesbeyond.com>
In-Reply-To: <ac03de2a0609c35568cde420cf34043b@threerings.net>
References:  <ac03de2a0609c35568cde420cf34043b@threerings.net>

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

On Tue, Jun 21, 2005 at 11:33:09AM -0700, Landon Fuller wrote:
> In j2se/src/solaris/native/sun/nio/ch/Net.c, getsockname() is called to 
> determine the local address and port of a socket.
> 
> Under both Linux and Solaris, getsockname() will only fail if invalid 
> arguments are provided. If getsockname() returns an error, Java throws 
> a java.lang.Error.
> On FreeBSD, getsockname() will also return an error with errno set to 
> ECONNRESET if the connection has been reset by the peer. Consequently, 
> Java throws a java.lang.Error.
> 
> The only way to handle this without an API change is to check for 
> ECONNRESET; In the attached patch, if errno is set to?ECONNRESET we 
> fill in the sockaddr structure with a port of 0, an IP of INADDR_ANY, 
> and clear out the error.

On Linux and/or Solaris, what happens when you call getsockname() on a
socket that has had the connection reset by the peer?  In particular,
is it compatible with what your patch does or are we introducing a new
scenario that the socket code for applications must handle?

> Also, any comments on the thread-safe resolver patch?

My bad, I haven't gotten to testing it yet :(.  One concern was that
you mention the routines you're using are thread safe under 5.4 and
better and I wondered if there was an impact on 4.x users?  I will
try and get this tested soon, as I want it in the next patchset.

-- 
Greg Lewis                          Email   : glewis@eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050621210125.GA96069>