From owner-freebsd-java@FreeBSD.ORG Tue Jun 21 21:01:28 2005 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D31C916A41C for ; Tue, 21 Jun 2005 21:01:28 +0000 (GMT) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (glewis.dsl.xmission.com [166.70.56.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A0B643D49 for ; Tue, 21 Jun 2005 21:01:28 +0000 (GMT) (envelope-from glewis@eyesbeyond.com) Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1]) by misty.eyesbeyond.com (8.13.3/8.13.3) with ESMTP id j5LL1QWB096349; Tue, 21 Jun 2005 15:01:26 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) Received: (from glewis@localhost) by misty.eyesbeyond.com (8.13.3/8.13.3/Submit) id j5LL1PE0096348; Tue, 21 Jun 2005 15:01:25 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) X-Authentication-Warning: misty.eyesbeyond.com: glewis set sender to glewis@eyesbeyond.com using -f Date: Tue, 21 Jun 2005 15:01:25 -0600 From: Greg Lewis To: Landon Fuller Message-ID: <20050621210125.GA96069@misty.eyesbeyond.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: freebsd-java@freebsd.org Subject: Re: [PATCH] jdk1.4.2, getsockname(), and ECONNRESET X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2005 21:01:29 -0000 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