Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 92879 invoked from network); 22 Nov 2006 14:13:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Nov 2006 14:13:00 -0000 Received: (qmail 9990 invoked by uid 500); 22 Nov 2006 14:13:07 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 9739 invoked by uid 500); 22 Nov 2006 14:13:06 -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 9730 invoked by uid 99); 22 Nov 2006 14:13:06 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2006 06:13:06 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [134.134.136.20] (HELO mga02.intel.com) (134.134.136.20) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Nov 2006 06:12:52 -0800 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by mga02.intel.com with ESMTP; 22 Nov 2006 06:12:32 -0800 Received: from fmsmsx333.amr.corp.intel.com ([132.233.42.2]) by orsmga001.jf.intel.com with ESMTP; 22 Nov 2006 06:12:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: i="4.09,448,1157353200"; d="scan'208"; a="165415708:sNHT26514306" Received: from mssmsx411.ccr.corp.intel.com ([10.125.2.10]) by fmsmsx333.amr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 22 Nov 2006 06:12:32 -0800 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [classlib][net] issue H-1879 HttpURLConnectionTest Date: Wed, 22 Nov 2006 17:12:20 +0300 Message-ID: <8E389A5F2FEABA4CB1DEC35A25CB39CE783197@mssmsx411> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [classlib][net] issue H-1879 HttpURLConnectionTest Thread-Index: AccNkGljzNVO073RRauipd79DdbL1gAqpNQg From: "Fedotov, Alexei A" To: X-OriginalArrivalTime: 22 Nov 2006 14:12:32.0396 (UTC) FILETIME=[405E34C0:01C70E40] X-Virus-Checked: Checked by ClamAV on apache.org Ok, I see. Makes sense for me. I cannot imagine anything better at this moment, and if this works, that's great. There is still a problem with accept() call which is not synchronized, but I don't see how we can fix this correctly. accept() call is synchronized using related ServerSocket object, but this doesn't help us - this blocking doesn't release an object lock. With best regards, Alexei Fedotov, Intel Java & XML Engineering >-----Original Message----- >From: Denis Kishenko [mailto:dkishenko@gmail.com] >Sent: Tuesday, November 21, 2006 8:06 PM >To: dev@harmony.apache.org >Subject: Re: [classlib][net] issue H-1879 HttpURLConnectionTest > >I can suggest add flag to avoid situation described above (see attached >fix). > >2006/11/21, Denis Kishenko : >> Alexei, >> >> Yep, syncronization is necessary but not such way. >> >> As you said, test try to control server/proxy starting using >> bound.wait(5000). It looks like on linux server/proxy thread started >> eallier then on winxp. >> >> In other words, what we are waiting for >> 1. start server thread >> 2. bound.wait >> 3. bound.notify >> 4. start proxy thread >> 5. bound.wait >> 6. bound.notify >> 7. connect >> but we have on linux >> 1. start server thread >> 2. bound.notify >> 3. bound.wait >> ---- wait 5 seconds ----- >> 4. start proxy thread >> 5. bound.notify >> 6. bound.wait >> ---- wait 5 seconds ----- >> 7. connect >> >> So we try to connect when proxy closed. >> >> 2006/11/21, Alexei Fedotov : >> > Denis, >> > Thank you for your fix! >> > >> > Here are few comments. I don't think we need to remove >> > synchronization. Contrary, I believe we need to fix it somehow. >> > >> > For example, when wait(5000) expires without notification, this means >> > that the test fail, and we better should report it right at the same >> > place. >> > >> > Digging further we can see that actual accept() calls are not >> > synchronized at all. There should be someting like conditional >> > variable to synchronize such events. I will write back when I get an >> > idea how to do it properly. >> > >> > A second option is to increase reading timeout set by setSoTimeout - >> > probably servers do not start fast enough. >> > >> > Thanks again, Alexei >> > >> > >> > On 11/21/06, Denis Kishenko wrote: >> > > Alexei, >> > > >> > > I attached fix to issue, could you try it, please? >> > > >> > > 2006/11/21, Alexei Fedotov : >> > > > Denis wrote, >> > > > > Yep, Harmony+DRLVM on SuSE >> > > > >> > > > A peculiar thing about this test is that it passes on SuSE 10, but >> > > > fails on SuSE 9 which is used for our regression test runs. >> > > > >> > > > -- >> > > > Thank you, >> > > > Alexei >> > > > >> > > > On 11/21/06, Denis Kishenko wrote: >> > > > > 2006/11/21, Jimmy, Jing Lv : >> > > > > > Denis Kishenko wrote: >> > > > > > > Hi all >> > > > > > > >> > > > > > > I'm investigating H-1879 and need some help or >recommendations from net >> > > > > > > guru. >> > > > > > > I have extracted failed test from >> > > > > > > >org.apache.harmony.tests.internal.net.www.protocol.http.HttpURLConnecti onTe >st, >> > > > > > > >> > > > > > > please see below. It failed with connection refused >exception. >> > > > > > > >> > > > > > > Java code works well, it looks like some problem with native >code. By >> > > > > > > the way telnet can't connect to created server too. >> > > > > > > >> > > > > > > If somebody can help with this issue it would be great. >> > > > > > > >> > > > > > > Thanks. >> > > > > > > >> > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Test = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> > > > > > > >> > > > > > > package >org.apache.harmony.tests.internal.net.www.protocol.http; >> > > > > > > >> > > > > > > import java.io.IOException; >> > > > > > > import java.net.HttpURLConnection; >> > > > > > > import java.net.InetSocketAddress; >> > > > > > > import java.net.Proxy; >> > > > > > > import java.net.ServerSocket; >> > > > > > > import java.net.Socket; >> > > > > > > import java.net.SocketTimeoutException; >> > > > > > > import java.net.URL; >> > > > > > > >> > > > > > > import junit.framework.TestCase; >> > > > > > > >> > > > > > > public class SimpleTest extends TestCase { >> > > > > > > >> > > > > > > private final static Object bound =3D new Object(); >> > > > > > > >> > > > > > > static class MockServer extends Thread { >> > > > > > > ServerSocket serverSocket; >> > > > > > > boolean accepted =3D false; >> > > > > > > >> > > > > > > public MockServer(String name) throws IOException { >> > > > > > > super(name); >> > > > > > > >> > > > > > > serverSocket =3D new ServerSocket(0); >> > > > > > > serverSocket.setSoTimeout(1000); >> > > > > > > } >> > > > > > > >> > > > > > > public int port() { >> > > > > > > return serverSocket.getLocalPort(); >> > > > > > > } >> > > > > > > >> > > > > > > public void run() { >> > > > > > > try { >> > > > > > > synchronized (bound) { >> > > > > > > bound.notify(); >> > > > > > > } >> > > > > > > try { >> > > > > > > serverSocket.accept().close(); >> > > > > > > accepted =3D true; >> > > > > > > } catch (SocketTimeoutException ignore) { >> > > > > > > } >> > > > > > > serverSocket.close(); >> > > > > > > } catch (IOException e) { >> > > > > > > throw new RuntimeException(e); >> > > > > > > } >> > > > > > > } >> > > > > > > } >> > > > > > > >> > > > > > > public void testUsingProxy() throws Exception { >> > > > > > > MockServer server =3D new MockServer("server"); >> > > > > > > MockServer proxy =3D new MockServer("proxy"); >> > > > > > > >> > > > > > > URL url =3D new URL("http://localhost:" + >server.port()); >> > > > > > > >> > > > > > > HttpURLConnection connection =3D = (HttpURLConnection) url >> > > > > > > .openConnection(new Proxy(Proxy.Type.HTTP, >> > > > > > > new InetSocketAddress("localhost", >> > > > > > > proxy.port()))); >> > > > > > > >> > > > > > > // HttpURLConnection connection =3D >> > > > > > > (HttpURLConnection)url.openConnection(); >> > > > > > > >> > > > > > > connection.setConnectTimeout(2000); >> > > > > > > connection.setReadTimeout(2000); >> > > > > > > >> > > > > > > server.start(); >> > > > > > > synchronized(bound) { >> > > > > > > bound.wait(5000); >> > > > > > > } >> > > > > > > proxy.start(); >> > > > > > > synchronized(bound) { >> > > > > > > bound.wait(5000); >> > > > > > > } >> > > > > > > >> > > > > > > connection.connect(); >> > > > > > > >> > > > > > > server.join(); >> > > > > > > proxy.join(); >> > > > > > > } >> > > > > > > >> > > > > > > } >> > > > > > > >> > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D Harmony+drlvm output = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> > > > > > > There was 1 error: >> > > > > > > 1) >> > > > > > > >testUsingProxy(org.apache.harmony.tests.internal.net.www.protocol.http. Simp >leTest)java.net.ConnectException: >> > > > > > > >> > > > > > > localhost/127.0.0.1:57896 - Connection refused >> > > > > > > at >> > > > > > > >org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.jav a:22 >4) >> > > > > > > >> > > > > > > at >> > > > > > > >org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.jav a:49 >6) >> > > > > > > >> > > > > > > at java.net.Socket.connect(Socket.java:980) >> > > > > > > at >> > > > > > > >org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectio n.ge >tHTTPConnection(HttpURLConnection.java:627) >> > > > > > > >> > > > > > > at >> > > > > > > >org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectio n.co >nnect(HttpURLConnection.java:608) >> > > > > > > >> > > > > > > at >> > > > > > > >org.apache.harmony.tests.internal.net.www.protocol.http.SimpleTest.test Usin >gProxy(SimpleTest.java:78) >> > > > > > > >> > > > > > > at java.lang.reflect.VMReflection.invokeMethod(Native >Method) >> > > > > > > >> > > > > > > FAILURES!!! >> > > > > > > Tests run: 1, Failures: 0, Errors: 1 >> > > > > > > >> > > > > > >> > > > > > The test passes on Harmony+IBMVME on WindowsXP on my desktop, >so you >> > > > > > mean Harmony+DRLVM here? >> > > > > Yep, Harmony+DRLVM on SuSE >> > > > > >> > > > > > >> > > > > > But IMHO the VM does not matter in network issues, the native >code call >> > > > > > directly to the system APIs(of course, through Port-Lib), so I >wonder if >> > > > > > there's something wrong in thread(handle by VM)? Just a >thought. >> > > > > > >> > > > > > And IMO, that telnet shall not connect to the server is due to >> > > > > > "serverSocket.setSoTimeout(1000);", which make >"serverSocket.accept()" >> > > > > > wait for only one second. >> > > > > Of course I had changed timeout to 10sec when used telnet :) >> > > > > >> > > > > > >> > > > > > I have to download Harmony+DRLVM to debug into, but the speed >of network >> > > > > > is poor here :) >> > > > > > >> > > > > > >> > > > > > -- >> > > > > > >> > > > > > Best Regards! >> > > > > > >> > > > > > Jimmy, Jing Lv >> > > > > > China Software Development Lab, IBM >> > > > > > >> > > > > >> > > > > >> > > > > -- >> > > > > Denis M. Kishenko >> > > > > Intel Middleware Products Division >> > > > > >> > > > >> > > >> > > >> > > -- >> > > Denis M. Kishenko >> > > Intel Middleware Products Division >> > > >> > >> > >> > -- >> > Thank you, >> > Alexei >> > >> >> >> -- >> Denis M. Kishenko >> Intel Middleware Products Division >> > > >-- >Denis M. Kishenko >Intel Middleware Products Division