Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 6512 invoked from network); 15 Jun 2007 14:46:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jun 2007 14:46:47 -0000 Received: (qmail 20729 invoked by uid 500); 15 Jun 2007 14:46:50 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 20632 invoked by uid 500); 15 Jun 2007 14:46:50 -0000 Mailing-List: contact commits-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 commits@harmony.apache.org Received: (qmail 20621 invoked by uid 99); 15 Jun 2007 14:46:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2007 07:46:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2007 07:46:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 18A0371413F for ; Fri, 15 Jun 2007 07:46:26 -0700 (PDT) Message-ID: <19012733.1181918786096.JavaMail.jira@brutus> Date: Fri, 15 Jun 2007 07:46:26 -0700 (PDT) From: "Pavel Afremov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-4024) [drlvm][thread] VM crashes when a lot of threads invoke setUncaughtExceptionHandler or setDefaultUncaughtExceptionHandler methods In-Reply-To: <29333679.1180699701525.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 [ https://issues.apache.org/jira/browse/HARMONY-4024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pavel Afremov updated HARMONY-4024: ----------------------------------- Attachment: 0001-Fix-of-Thread-ID-bug.patch Fix of Thread ID bug. Patch radices quantity of Thread IDs to 0x7FFF to match lock word format and add opportunity to reuse dead threads IDs in new threads. Patch fix described problem but doesn't allow test to works OK. Large memory leak was found. The source of this leak is that hythread_thin_monitor_destroy and hythread_monitor_destroy aren't called during GC's, I add debug printing to check it. The other possible source is usage of apr_pool. As result of memory leak significant performace degradation was appered. > [drlvm][thread] VM crashes when a lot of threads invoke setUncaughtExceptionHandler or setDefaultUncaughtExceptionHandler methods > ---------------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-4024 > URL: https://issues.apache.org/jira/browse/HARMONY-4024 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Environment: Windows > Reporter: Vera Petrashkova > Priority: Minor > Attachments: 0001-Fix-of-Thread-ID-bug.patch > > > The following test demonstrates that VM crashes when a lot of created threads use setUncaughtExceptionHandler > or setDefaultUncaughtExceptionHandler methods > --------------a1.java------------------- > public class a1 extends Thread { > public static int N_TH = 20; > public static void main (String[] argv) { > boolean def = true; > if (argv.length > 0) { > def = "true".equals(argv[0]); > } > try { > if (argv.length > 1) { > N_TH=Integer.parseInt(argv[1]); > } > } catch (Throwable e) { > } > a1_UncoughtExcHnd h = new a1_UncoughtExcHnd(); > for (int i = 0; i < 100000; i++) { > test(def, h); > if (i % 1000 == 0) { > System.err.println("Step: " + i + " finished"); > } > } > System.out.println("Test passed"); > } > public static void test(boolean defUncaught, a1_UncoughtExcHnd hnd) { > a1 t[] = new a1[N_TH]; > for (int i = 0; i < N_TH; i++) { > t[i]=new a1(); > if (defUncaught) { > t[i].setDefaultUncaughtExceptionHandler(hnd); > } else { > t[i].setUncaughtExceptionHandler(hnd); > } > t[i].start(); > } > try { > for (int i = 0; i < N_TH; i++) { > t[i].join(); > } > } catch (Throwable e) { > System.err.println(e); > } > } > public void m(int t) { > int t1 = 100/t; > } > public void run() { > m(0); > } > } > class a1_UncoughtExcHnd implements Thread.UncaughtExceptionHandler { > public static int count = 0; > public void uncaughtException(Thread t, Throwable e) { > count++; > throw new RuntimeException(e); > } > } > -------------------------------- > Run test with DefaultUncaughtExceptionHandler > java -cp . a1 true 20 > and with UncaughtExceptionHandler > java -cp . a1 false 20 > This test passes on RI in both cases: > Output: > ======= > On RI this test passes: > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode) > Step: 0 finished > ... > Step: 94000 finished > Step: 95000 finished > Step: 96000 finished > Step: 97000 finished > Step: 98000 finished > Step: 99000 finished > Test passed > DRLVM crashes on this test in both cases. > Output: > ====== > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l > icensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r542118, (May 28 2007), Windows/ia32/msvc 1310, release build > http://incubator.apache.org/harmony > Step: 0 finished > The GC did not provide gc_add_weak_root_set_entry() > Step: 1000 finished > Windows reported exception: 0xc0000005 > Registers: > EAX: 0x00000000, EBX: 0x41c14bf8, ECX: 0x0e810048, EDX: 0x003927a4 > ESI: 0x00000000, EDI: 0x0babfe80, ESP: 0x0babfda0, EBP: 0x0babfddc > EIP: 0x10002a1e > Stack trace: > 0: hythread_monitor_notify_all (??:-1) > 1: java/lang/VMThreadManager.notifyAll(Ljava/lang/Object;)I (VMThreadManager.java:-2) > 2: java/lang/Object.notifyAll()V (Object.java:65) > 3: java/lang/Thread.runImpl()V (Thread.java:667) > > DRLVM crashes even if only 1 thread is created on the each step. > java -cp . a1 true 1 > Output > =========== > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r542118, (May 28 2007), Windows/ia32/msvc 1310, release build > http://incubator.apache.org/harmony > Step: 0 finished > The GC did not provide gc_add_weak_root_set_entry() > Step: 1000 finished > Step: 2000 finished > Step: 3000 finished > .... > Step: 29000 finished > Step: 30000 finished > Step: 31000 finished > Step: 32000 finished > Step: 33000 finished > Windows reported exception: 0xc0000005 > Registers: > EAX: 0x00000000, EBX: 0x41c17188, ECX: 0x0e810048, EDX: 0x003927a4 > ESI: 0x00000000, EDI: 0x041ffe80, ESP: 0x041ffda0, EBP: 0x041ffddc > EIP: 0x10002a1e > Stack trace: > 0: hythread_monitor_notify_all (??:-1) > 1: java/lang/VMThreadManager.notifyAll(Ljava/lang/Object;)I (VMThreadManager.java:-2) > 2: java/lang/Object.notifyAll()V (Object.java:65) > 3: java/lang/Thread.runImpl()V (Thread.java:667) > > This bug causes the failure of the reliability test > api.kernel.thread.ExcptHandlerTest.ExcptHandlerTest > from http://issues.apache.org/jira/browse/HARMONY-2918 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.