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

Java Crash in JavaBug.formatPos(I)Ljava/lang/String

XMLWordPrintable

    • b105
    • 9
    • b34
    • x86_64
    • generic
    • Verified

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)


      FULL OS VERSION :
      Linux N042 4.10.0-37-generic #41~16.04.1-Ubuntu SMP Fri Oct 6 22:42:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007fe05160fd22, pid=1101, tid=1102
      #
      # JRE version: Java(TM) SE Runtime Environment (9.0+11) (build 9.0.1+11)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (9.0.1+11, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
      # Problematic frame:
      # J 210 c2 JavaBug.formatPos(I)Ljava/lang/String; (97 bytes) @ 0x00007fe05160fd22 [0x00007fe05160fca0+0x0000000000000082]
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /home/mbu/tmp/JavaBug/core.1101)
      #
      # An error report file with more information is saved as:
      # /home/mbu/tmp/JavaBug/hs_err_pid1101.log
      Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #


      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      REGRESSION. Last worked in version 8u152

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the demo code and run it.
      The JCM crashes after about 2500 iterations. Sometimes earlier, sometimes later.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      No SIGSEGV
      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class JavaBug {
        public static void main(String[] args) {
          for (int i = 0; i < 1000000; i++) {
            System.out.println(i);
            String foo = formatPos(i);
            }
          }

          private static String formatPos( int p )
          {
            boolean negative = p < 0;
            if ( negative )
              p = -p;
            char[] ac = new char[12];
            int i = 11;
            while (p != 0 || i > 3)
            {
              ac[i--] = (char) ( '0' + ( p % 10 ) );
              p /= 10;
              if ( i == 5 )
                ac[i--] = '.';
            }
            if ( negative )
              ac[i--] = '-';
            return new String( ac, i + 1, 11 - i );
        }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Java 8

            roland Roland Westrelin
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: