Infinite stack trace flooding during reflected recursive call

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Software:
          System Software Overview:
            System Version: Ubuntu 22.04.4 LTS
            Kernel Version: 4.15.0-45-generic
            Boot Volume: overlay
            Boot Mode: Legacy BIOS
            Computer Name: 899309ef3feb
            User Name: root
            Time since boot: 21 weeks, 2 days, 6 hours, 47 minutes

      Hardware:
          Hardware Overview:
            Model: Unknown
            Model Identifier: Unknown
            Chip: Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
            Total Number of Cores: 40 (10 physical x 2 logical)
            Memory: 125Gi
            System Firmware Version: Unknown

      A DESCRIPTION OF THE PROBLEM :
      When a method performs deep recursion via reflection, HotSpot exhibits a pathological behavior where it floods the standard error with millions of lines of stack trace.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. javac Test.java
      2. java -Xcomp Test

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void doCall(int claims) {
              if (claims == 0)
                  return;

              try {
                  java.lang.reflect.Method m = Test.class.getMethod("doCall", new Class[]{int.class});
                  m.invoke(null, claims - 1);
              } catch (Throwable e) {
                  throw new RuntimeException(e);
              }
          }

          public static void main(String[] args) {
              for (int i = 0; i < 10000; i++) {
                  doCall(i);
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY :
      ALWAYS

            Assignee:
            David Holmes
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: