harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Berezhniuk (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3627) [drlvm][exception] VM works incorrectly if several threads catch StackOverflowError
Date Fri, 22 Jun 2007 23:22:26 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507543
] 

Ilya Berezhniuk commented on HARMONY-3627:
------------------------------------------

Debug printing I've inserted shows that when we set guard page, we always do this correctly
- even if test crashes.
But access violation is catched under Visual Studio and under NTSD after hundreds of runs.
NTSD it quite uncomfortable, so I've wrote program to press F5 in Visual Studio :) and catched
access violation.

Crash occurs in native code. Seems like curcumstances are the following: when some thread
has consumed almost all stack and has almost reached guard page, recursive method m() reaches
particular invocation count to become 'hot' method - so recompilation is started. Thread goes
into VM/JIT code, and stack overflow occurs in native code in non-unwindable area. When VEH
catches stack overflow, it simply raises exception end returns CONTINUE_EXECUTION. Then recompiled
method continues recursion, and stack reaches non-mapped memory - we got access violation.

I tried to run test with -Xem:jet and -Xem:opt to prevent recompilation, it doesn't crash
with thousands of runs- it's an argument for described situation.

But I'm not sure absolutely and will try to assure. The argument against is that non-unwindable
area is usually wrapped with BEGIN_RAISE_AREA/END_RAISE_AREA macros, and END_RAISE_AREA includes
exn_rethrow_if_pending() - so raised exception should be thrown and guard page restored.

> [drlvm][exception] VM works incorrectly if several threads catch StackOverflowError
> -----------------------------------------------------------------------------------
>
>                 Key: HARMONY-3627
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3627
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Vera Petrashkova
>            Priority: Minor
>
> When several threads expect  StackOverflowError then VM works incorrectly.
> The following test demonstrates this issue.
> VM crashes or finish its run abnormally.
> ----------------test.java-------------------
> public class test extends Thread {
>    public static void main (String[] argv) {
>         int N_TH = 5;
>         try {
>             if (argv.length > 0) {
>                 N_TH=Integer.parseInt(argv[0]);
>             }
>         } catch (Throwable e) {
>         }
>         test t[] = new test[N_TH];
>         for (int i = 0; i < N_TH; i++) {
>             t[i]=new test();
>             t[i].start();
>         }
>         try {
>             for (int i = 0; i < N_TH; i++) {
>                 t[i].join();
>             }
>         } catch (Throwable e) {
>             System.err.println(e);
>         }
>         System.out.println("Test passed");
>     }
>     public void m(int t) {
>              m(t+1);
>     }
>     public void run() {
>         System.err.println("Start");
>         try {
>             m(0);
>         } catch (StackOverflowError e) {
>         }
>     }
> }
> ------------------------------
> Run test
> java  -cp . test 20
> Output:
> Sometimes test passes.
> 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 = r526746, (Apr 10 2007), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Start
> ...
> Start
> Test passed
> But  usually VM does not report full message and finishes execution or crashes:
> Start
> Start
> Start

-- 
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