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

JVM crash with assert(Universe::heap()->is_in(result)) failed: object not in heap

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS - Windows 8.1/10, Windows Server 2016, did not try Linux/Unix
      Java - on Java 15 and 16 the script fails after few seconds, on Java 11 it took 8 hours to fail, didn't try older Java versions (but as Java 8 was using Parallel GC as default we would expect Java 8 is fine)
      JVM options: -Xms4096m -Xmx4096m


      A DESCRIPTION OF THE PROBLEM :
      JVM is crashing when running the attached script. The issue seems to be related to GC1 as we weren't able to reproduce it with different type of GC.
      We run to this issue via Spring BeanUtils class when upgradin spring-beans from version 5.1.19 where the issue were not exposed. After upgrading to spring-beans 5.3.5 where the BeanUtils class has changed we started to experience the jvm crash.
      Our application is creating big amount of bean instances (hundred per seconds) so this is why the issue is likely to happen in our environment.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached script with:
      JRE version: OpenJDK Runtime Environment (16.0+36)
      JVM options: -Xms4096m -Xmx4096m
      classpaht: spring-beans-5.3.5.jar, spring-core-5.3.5.jar,spring-jcl-5.3.5.jar


      ACTUAL -
      hs_err_pidxy.log as below:

      ---------- BEGIN SOURCE ----------
      package com.solarwinds;

      import java.time.LocalDateTime;
      import java.util.function.IntConsumer;
      import java.util.stream.IntStream;

      import org.springframework.beans.BeanUtils;

      public class Main {
      private static final int THREAD_COUNT = 4000; // Specify more threads for the issue to manifest itself sooner

      public Main() {
      }

      public Main(String value) {
      }

      public static void main(String[] args) {
      for (int i = 0; i < THREAD_COUNT; i++) {
      Thread thread;
      switch (i % 4) {
      case 1:
      thread = new Thread(() -> doWork(l -> BeanUtils.instantiateClass(Main.class)));
      break;
      case 2:
      thread = new Thread(() -> doWork(l -> BeanUtils.instantiateClass(Main.class, Main.class)));
      break;
      case 3:
      thread = new Thread(() -> doWork(l -> {
      try {
      BeanUtils.instantiateClass(Main.class.getConstructor(String.class), (String) null);
      } catch (NoSuchMethodException ex) {
      ex.printStackTrace();
      }
      }));
      break;
      default:
      thread = new Thread(() -> doWork(l -> {
      try {
      BeanUtils.instantiateClass(Main.class.getConstructor(String.class), "test");
      } catch (NoSuchMethodException ex) {
      ex.printStackTrace();
      }
      }));
      break;
      }
      thread.setDaemon(false);
      thread.start();
      System.out.println(LocalDateTime.now() + " started thread " + i);
      }
      }

      private static void doWork(IntConsumer consumer) {
      try {
      Thread.sleep(2000);
      } catch (InterruptedException ex) {
      ex.printStackTrace();
      }
      IntStream.range(Integer.MIN_VALUE, Integer.MAX_VALUE).forEach(consumer);
      }
      }

      ---------- END SOURCE ----------

      FREQUENCY : often


        Attachments

        1. hs_error.log
          847 kB
        2. Main.java
          1 kB

          Issue Links

            Activity

              People

              Assignee:
              thartmann Tobias Hartmann
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: