harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Afremov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-4024) [drlvm][thread] VM crashes when a lot of threads invoke setUncaughtExceptionHandler or setDefaultUncaughtExceptionHandler methods
Date Fri, 15 Jun 2007 14:46:26 GMT

     [ 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)
> <end of stack trace>
> 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)
> <end of stack trace>
> 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.


Mime
View raw message