Harmony
  1. Harmony
  2. HARMONY-5790

[drlvm][interpreter] Stack size is not enough

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 5.0M5
    • Fix Version/s: None
    • Component/s: build - test - ci, DRLVM
    • Labels:
      None
    • Environment:
      Linux/32, Windows/64, Interpreter

      Description

      The following simple test sometimes causes a stack overflow.

      public class Test {
      static interface Sample1

      { public <T extends Sample1, E extends Throwable> T test(T param) throws E; }

      static interface Sample2

      { public <T extends Sample2, E extends Throwable> T test(T param) throws E; }

      static boolean success;
      public static void main(String[] args) {
      try

      { Sample1.class.getMethods()[0].getGenericParameterTypes(); System.out.println("Main thread: OK"); }

      catch (StackOverflowError e)

      { System.out.println("Main thread: ERROR: "); e.printStackTrace(System.out); }

      success = false;
      Thread thread = new Thread() {
      public void run() {
      try

      { Sample2.class.getMethods()[0].getGenericParameterTypes(); System.out.println("Child thread: OK"); }

      catch (Throwable e)

      { System.out.println("Child thread: ERROR: "); e.printStackTrace(System.out); }

      }
      };
      thread.start();
      }
      }

      As the test is very simple and only makes a one trivial reflection call in main and child threads, it seems evident that stack size is just not enough for the Interpreter to work and needs to be increased.

      The error was discovered as test java.lang.reflect.MethodTest.test_getGeneric(), that is a regression test for HARMONY-5622, was failing in main thread on Windows/64, and in a separate thread on Linux/32:

      http://people.apache.org/~smishura/r650380/Linux_x86/drlvm-test/

      Now the test is commented out, but the proper fix would be to increase the stack size in interpreter mode and uncomment the test.

        Issue Links

          Activity

          Vasily Zakharov made changes -
          Description The following simple test sometimes causes a stack overflow.

          public class Test {
              static interface Sample1 {
                  public <T extends Sample1, E extends Throwable> T test(T param) throws E;
              }
              static interface Sample2 {
                  public <T extends Sample2, E extends Throwable> T test(T param) throws E;
              }
              static boolean success;
              public static void main(String[] args) {
                  try {
                      Sample1.class.getMethods()[0].getGenericParameterTypes();
                      System.out.println("Main thread: OK");
                  } catch (StackOverflowError e) {
                      System.out.println("Main thread: ERROR: ");
                      e.printStackTrace(System.out);
                  }
                  success = false;
                  Thread thread = new Thread() {
                      public void run() {
                          try {
                              Sample2.class.getMethods()[0].getGenericParameterTypes();
                              System.out.println("Child thread: OK");
                          } catch (Throwable e) {
                              System.out.println("Child thread: ERROR: ");
                              e.printStackTrace(System.out);
                          }
                      }
                  };
                  thread.start();
              }
          }

          As the test is very simple and only makes a one trivial reflection call in main and child threads, it seems evident that stack size is just not enough for the Interpreter to work and needs to be increased.

          The error was discovered as test java.lang.reflect.MethodTest.test_getGeneric(), that is a regression test for HARMONY-5622 was failing in main thread on Windows/64, and in a separate thread on Linux/32.

          Now the test is commented out, but the proper fix would be to increase the stack size in interpreter mode and uncomment the test.
          The following simple test sometimes causes a stack overflow.

          public class Test {
              static interface Sample1 {
                  public <T extends Sample1, E extends Throwable> T test(T param) throws E;
              }
              static interface Sample2 {
                  public <T extends Sample2, E extends Throwable> T test(T param) throws E;
              }
              static boolean success;
              public static void main(String[] args) {
                  try {
                      Sample1.class.getMethods()[0].getGenericParameterTypes();
                      System.out.println("Main thread: OK");
                  } catch (StackOverflowError e) {
                      System.out.println("Main thread: ERROR: ");
                      e.printStackTrace(System.out);
                  }
                  success = false;
                  Thread thread = new Thread() {
                      public void run() {
                          try {
                              Sample2.class.getMethods()[0].getGenericParameterTypes();
                              System.out.println("Child thread: OK");
                          } catch (Throwable e) {
                              System.out.println("Child thread: ERROR: ");
                              e.printStackTrace(System.out);
                          }
                      }
                  };
                  thread.start();
              }
          }

          As the test is very simple and only makes a one trivial reflection call in main and child threads, it seems evident that stack size is just not enough for the Interpreter to work and needs to be increased.

          The error was discovered as test java.lang.reflect.MethodTest.test_getGeneric(), that is a regression test for HARMONY-5622, was failing in main thread on Windows/64, and in a separate thread on Linux/32:

          http://people.apache.org/~smishura/r650380/Linux_x86/drlvm-test/

          Now the test is commented out, but the proper fix would be to increase the stack size in interpreter mode and uncomment the test.
          Vasily Zakharov made changes -
          Field Original Value New Value
          Link This issue is related to HARMONY-5622 [ HARMONY-5622 ]
          Vasily Zakharov created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Vasily Zakharov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Development