Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 1062 invoked from network); 18 Apr 2007 07:45:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2007 07:45:07 -0000 Received: (qmail 26658 invoked by uid 500); 18 Apr 2007 07:45:10 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 26626 invoked by uid 500); 18 Apr 2007 07:45:10 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 26617 invoked by uid 99); 18 Apr 2007 07:45:10 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2007 00:45:10 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of zhanghuangzhu@gmail.com designates 209.85.132.241 as permitted sender) Received: from [209.85.132.241] (HELO an-out-0708.google.com) (209.85.132.241) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2007 00:45:02 -0700 Received: by an-out-0708.google.com with SMTP id b2so93731ana for ; Wed, 18 Apr 2007 00:44:41 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=NY+tJVBqQ+4bYy+TVQ7tvKQmury/95D5FDZS7c08z2vmZBHM6HXXcuZCkDLPwS+TrBK+AUmrATBRBqUKzZtRoXwvAtj5WO6ckQECLxacDjw0EKScGjlgKKEuvVZJpRAcUFuh0LNcMZQwLv9RPf+WWsIPNIwt45lxiSM0SCqUqHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=uI9PCIi+qXDc+EpfHogvDziEllCAsY7HBQ64LQLFYR6pmwL9ryiyZSPpG2+kgzGbeyDZSP/mraiPpHlE78PUZXV5dbgL8yfSE1SeIYetxDX85NbEa+8HCOJsfVQe3jkVqEj9wPL2tPwm+BO8o0uy5ruULDDEYX4+pQwcZOVE0Ms= Received: by 10.100.174.16 with SMTP id w16mr156745ane.1176882279411; Wed, 18 Apr 2007 00:44:39 -0700 (PDT) Received: by 10.100.131.19 with HTTP; Wed, 18 Apr 2007 00:44:39 -0700 (PDT) Message-ID: <4d0b24970704180044y40e6d391q7d0e6ad4586e20ec@mail.gmail.com> Date: Wed, 18 Apr 2007 15:44:39 +0800 From: "Andrew Zhang" To: dev@harmony.apache.org Subject: Re: [classlib][luni] new test in tests.api.java.net.SocketTest failed on my Windows XP sp2 In-Reply-To: <5c8e69f0704172025r773eba76w40f068d060026a1@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_130147_16987658.1176882279298" References: <7273946b0704170150u10fe9f13vd430f0a3aa0399e2@mail.gmail.com> <46248CBA.7010702@gmail.com> <7273946b0704170216k43e3165cx30a19eb0ce27ea92@mail.gmail.com> <462498F7.6050300@gmail.com> <4624B462.1030607@gmail.com> <3b3f27c60704171505g21278641gf528578f6da3608@mail.gmail.com> <211709bc0704172011v633a552bubab887221a30a680@mail.gmail.com> <5c8e69f0704172025r773eba76w40f068d060026a1@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_130147_16987658.1176882279298 Content-Type: text/plain; charset=ISO-2022-JP; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 4/18/07, LvJimmy,Jing wrote: > > This method is good, but not perfect, for > 1. getNextPortsForUDP get a free port by a mechanism "get and > release", but release the port may not be successful (e.g, in linux) > 2. even it releases successfully, during the period between utility > method "release" and serversocket reuse it, there may be some other > program reuse the port, which cause the test fail again. Open and close is not safe in theory, as we discussed before. Let's stop getNextPort, and stick to use port 0. :) I think we have agreed that a long time ago. 3. this may cost much more time to get a port. > The perfect solution for this is re-write the testcases, create > ServerSocket with port 0, and then get the local port for socket to > connect. However I guess it may cause a lot of affect. yes, but we can do it lazily and gradually. The important thing is that we should not use the buggy getNextPort any more.... 2007/4/18, Tony Wu : > > Hi Nathan, > > Many testcases in ServerSocketTest use port 0 to start the server then > > call getLocalPort to get the actual port. > > > > BTW, the PortManger.getNextPortsForUDP makes use of port 0 to get the > > real port number. It's safer, I suggest to replace all the getNextPort > > with this method in our code. > > > > On 4/18/07, Nathan Beyer wrote: > > > For the slow (and lazy), can you point me to one of the tests that > > > just uses port 0. > > > > > > Thanks. > > > > > > -Nathan > > > > > > On 4/17/07, Tim Ellison wrote: > > > > Ruth Cao wrote: > > > > > You are right, Vladimir. > > > > > > > > > > It is just because the 'port' variable is set to 8080 and on some > > > > > machines this port has already been occupied. The test case will > pass > > > > > if we use Support_PortManager.getNextPort() on my side. > > > > > > > > Please don't use the PortManager, just open port 0 and let the OS > > > > allocate a free port. There are examples in the existing tests. > > > > > > > > Regards, > > > > Tim > > > > > > > > > > > > > -- > > Tony Wu > > China Software Development Lab, IBM > > > > > -- > > Best Regards! > > Jimmy, Jing Lv > China Software Development Lab, IBM > -- Best regards, Andrew Zhang ------=_Part_130147_16987658.1176882279298--