Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 67646 invoked from network); 29 Aug 2006 01:41:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Aug 2006 01:41:59 -0000 Received: (qmail 41516 invoked by uid 500); 29 Aug 2006 01:41:54 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 41476 invoked by uid 500); 29 Aug 2006 01:41:53 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 41430 invoked by uid 99); 29 Aug 2006 01:41:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Aug 2006 18:41:53 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of zhanghuangzhu@gmail.com designates 66.249.82.235 as permitted sender) Received: from [66.249.82.235] (HELO wx-out-0506.google.com) (66.249.82.235) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Aug 2006 18:41:51 -0700 Received: by wx-out-0506.google.com with SMTP id s13so1844125wxc for ; Mon, 28 Aug 2006 18:41:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=qPmIPbNdLjYMWnxFyl1ylNhIzPS7aUVxKDuiIIrBJwFlLgOOTKPs5+VjrD5Yb15xnBhghNwKoct64MKPGWg23drBP0YcrUfIqYFBFG+83ufH8w3qWPIrAiRU1Obe8Fm/3eYiR6oRmKtwSuZn+G0SSxQJAfYdPqW3Y00oWmbjClc= Received: by 10.70.67.15 with SMTP id p15mr10389490wxa; Mon, 28 Aug 2006 18:41:11 -0700 (PDT) Received: by 10.70.123.4 with HTTP; Mon, 28 Aug 2006 18:41:11 -0700 (PDT) Message-ID: <4d0b24970608281841y7a1b370ax93c62abac750c183@mail.gmail.com> Date: Tue, 29 Aug 2006 09:41:11 +0800 From: "Andrew Zhang" To: harmony-dev@incubator.apache.org Subject: Re: [jira] Created: (HARMONY-1295) [classlib][net] flaw in setReuseAddrAndReusePort() In-Reply-To: <657651.1156763422386.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_849_10216149.1156815671712" References: <657651.1156763422386.JavaMail.jira@brutus> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_849_10216149.1156815671712 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/28/06, Alexey Varlamov (JIRA) wrote: > > [classlib][net] flaw in setReuseAddrAndReusePort() > -------------------------------------------------- > > Key: HARMONY-1295 > URL: http://issues.apache.org/jira/browse/HARMONY-1295 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Alexey Varlamov > Priority: Critical > > > The tests.api.java.net.DatagramSocketTest test crashes on assert in DRLVM > : Assertion `IsInstanceOf(env, obj, struct_Class_to_jclass(f->get_class()))' > failed. > The reason is that java.net.DatagramSocket.setReuseAddress(boolean) calls > to > PlainDatagramSocketImpl.setOption(int optID, Object val) with Boolean > value, but underlying native code treats this value as Integer. > > Quickfix must be straightforward enough, but I inclined to blame the > design of INetworkSystem.[set|get]SocketOption() as the actual root of the > evil. The problem is that this API conceals the details of contract for > particular options, and a client have to guess which type of value to pass. I think it's "determine", not "guess". :) And the implementation is basically an ugly switch sorting requests out to > setBoolSocketOption() or setIntegerSocketOption(), etc. Shouldn'te refactor > this? Any proposals? Thanks! Native stack is : > vmcore.dll!GetIntField(JNIEnv_External * env=0x103353a8, _jobject * > obj=0x0654f184, _jfieldID * fieldID=0x05e4c088) Line 304 + 0x3a C++ > hyluni.dll!intValue(const JNINativeInterface_ * * env=0x103353a8, _jobject > * anInteger=0x0654f184) Line 598 + 0x1d C > hyluni.dll!setReuseAddrAndReusePort(const JNINativeInterface_ * * > env=0x103353a8, hysocket_struct * hysocketP=0x00160ae0, _jobject * > optVal=0x0654f184) Line 1140 C > > hyluni.dll!Java_org_apache_harmony_luni_platform_OSNetworkSystem_setSocketOptionImpl(const > JNINativeInterface_ * * env=, _jobject * thisClz=, _jobject * > aFileDescriptor=, int anOption=, _jobject * aValue=) Line 2321 + 0xc C > > Java stack is: > Stack Trace (003FB238): > [003FB238] 00000000(n): > org/apache/harmony/luni/platform/OSNetworkSystem.setSocketOptionImpl(Ljava > /io/FileDescriptor;ILjava/lang/Object;)V > [003FB238] 011D0625(m): > org/apache/harmony/luni/platform/OSNetworkSystem.setSocketOption(Ljava/io/ > FileDescriptor;ILjava/lang/Object;)V > [003FB238] 011CFF4E(m): > org/apache/harmony/luni/net/PlainDatagramSocketImpl.setOption(ILjava/lang/ > Object;)V > [003FB238] 011E3DB1(m): java/net/DatagramSocket.setReuseAddress(Z)V > [003FB238] 011E3BB0(m): > tests/api/java/net/DatagramSocketTest.test_getReuseAddress()V > [003FB238] 100657D0(n): > java/lang/reflect/VMReflection.invokeMethod(Ljava/lang/Object;Ljava/lang/O > bject;[Ljava/lang/Object;)Ljava/lang/Object; > [003FB238] 011C2CA0(m): > java/lang/reflect/Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljav > a/lang/Object; > [003FB238] 011CCB25(m): junit/framework/TestCase.runTest()V > [003FB238] 011CC66E(m): junit/framework/TestCase.runBare()V > [003FB238] 011CC5BA(m): junit/framework/TestResult$1.protect()V > [003FB238] 011CC44F(m): > junit/framework/TestResult.runProtected(Ljunit/framework/Test;Ljunit/frame > work/Protectable;)V > [003FB238] 011CAA3C(m): > junit/framework/TestResult.run(Ljunit/framework/TestCase;)V > [003FB238] 011CA910(m): > junit/framework/TestCase.run(Ljunit/framework/TestResult;)V > [003FB238] 011CA85B(m): > junit/framework/TestSuite.runTest(Ljunit/framework/Test;Ljunit/framework/T > estResult;)V > [003FB238] 011CA12E(m): > junit/framework/TestSuite.run(Ljunit/framework/TestResult;)V > [003FB238] 011C9B22(m): > junit/textui/TestRunner.doRun(Ljunit/framework/Test;Z)Ljunit/framework/Tes > tResult; > [003FB238] 011C4186(m): > junit/textui/TestRunner.start([Ljava/lang/String;)Ljunit/framework/TestRes > ult; > [003FB238] 011C365E(m): junit/textui/TestRunner.main([Ljava/lang/String;)V > [003FB238] 100657D0(n): > java/lang/reflect/VMReflection.invokeMethod(Ljava/lang/Object;Ljava/lang/O > bject;[Ljava/lang/Object;)Ljava/lang/Object; > [003FB238] 011C2CA0(m): > java/lang/reflect/Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljav > a/lang/Object; > [003FB238] 011A59DF(m): java/lang/VMStart$MainThread.runImpl()V > [003FB238] 100657D0(n): *null* > End Stack Trace (003FB238, depth=22) > > -- > This message is automatically generated by JIRA. > - > If you think it was sent incorrectly contact one of the administrators: > http://issues.apache.org/jira/secure/Administrators.jspa > - > For more information on JIRA, see: http://www.atlassian.com/software/jira > > > -- Andrew Zhang China Software Development Lab, IBM ------=_Part_849_10216149.1156815671712--