Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 12991 invoked from network); 28 Aug 2006 23:03:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Aug 2006 23:03:45 -0000 Received: (qmail 27408 invoked by uid 500); 28 Aug 2006 23:03:45 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 27342 invoked by uid 500); 28 Aug 2006 23:03:44 -0000 Mailing-List: contact harmony-commits-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-commits@incubator.apache.org Received: (qmail 27300 invoked by uid 99); 28 Aug 2006 23:03:44 -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 16:03:44 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Aug 2006 16:03:41 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D75B07142D0 for ; Mon, 28 Aug 2006 23:00:25 +0000 (GMT) Message-ID: <14457230.1156806025879.JavaMail.jira@brutus> Date: Mon, 28 Aug 2006 16:00:25 -0700 (PDT) From: "Gregory Shimansky (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Commented: (HARMONY-1295) [classlib][net] flaw in setReuseAddrAndReusePort() In-Reply-To: <657651.1156763422386.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-1295?page=comments#action_12431092 ] Gregory Shimansky commented on HARMONY-1295: -------------------------------------------- Well, you cannot deny that GetIntField is called in the end in native code which is the reason for failed assertion. The field ID which is used for GetIntField is an ID of a field in java.lang.Integer class which I think is wrong when applied to an object of java.lang.Boolean class. Alexey's stack trace shows this and I've reproduced the same trace myself. Also it is not setBoolSocketOption, it is setReuseAddrAndReusePort according to stack trace. > [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. And the implementation is basically an ugly switch sorting requests out to setBoolSocketOption() or setIntegerSocketOption(), etc. Shouldn'te refactor this? > 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