Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8157521

VM crashes on Windows instead of throwing StackOverflowError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 9
    • 9
    • hotspot
    • None
    • x86_64
    • windows

      A simple recursive program may crash JVM with EXCEPTION_STACK_OVERFLOW.

      public class RecursiveCall {
          static int depth;

          public static void main(String[] args) {
              try {
                  recursive();
              } catch (StackOverflowError e) {
                  System.out.println(depth);
              }
          }

          static void recursive() {
              depth++;
              recursive();
          }
      }

      I can always reproduce it within a few minutes when running the following batch file on Windows x64:

      :loop
      java -XX:CompileOnly=RecursiveCall RecursiveCall
      goto loop

      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+119)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+119, mixed mode)

      The bug looks similar to JDK-8152598, but that one was closed as a duplicate of non-public issue. So I'll leave this one in order to provide the publicly available description, initial analysis and the proposed solution (see comments), and also to track the status of the fix.

            neliasso Nils Eliasson (Inactive)
            apangin Andrei Pangin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: