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

JDWP Transport Listener causes JVM to crash when remote debugging

    Details

      Description

      FULL PRODUCT VERSION :
      openjdk version "1.8.0_121"
      OpenJDK Runtime Environment (build 1.8.0_121-b13)
      OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 4.9.6-1-ARCH #1 SMP PREEMPT Thu Jan 26 09:22:26 CET 2017 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When trying to remote debug the attached class the JVM frequently crashes with a SIGSEGV. Probably this is caused by the synchronized access to the Count#increment by the different RecrusiveTasks.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and remote debug the attached program using the following command:
      java -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n VMTest

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JVM should not crash when remote debugging.
      ACTUAL -
      The JVM crashes with SIGSEGV when trying to remote debug the program.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007f48462a83fc, pid=22671, tid=0x00007f482c450700
      #
      # JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
      # Java VM: OpenJDK 64-Bit Server VM (25.121-b13 interpreted mode linux-amd64 compressed oops)
      # Problematic frame:
      # V [libjvm.so+0x6493fc]
      #
      # Core dump written. Default location: /home/yann/Workspaces/default/test/core or core.22671
      #
      # An error report file with more information is saved as:
      # /home/yann/Workspaces/default/test/hs_err_pid22671.log
      cnt: 11111100, pool size:
      Thread-0 finished.
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #


      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      import java.io.IOException;
      import java.util.ArrayList;
      import java.util.List;
      import java.util.concurrent.ForkJoinPool;
      import java.util.concurrent.ForkJoinTask;
      import java.util.concurrent.RecursiveAction;

      public class VMTest {

          static class Count {
              long cnt = 0;
              public synchronized void increment() {
                  cnt++;
              }
          }

          static class RecrusiveTask extends RecursiveAction {
              final Count count;
              final int recrusions, forks, calls;

              RecrusiveTask(final Count count, final int maxRecrusion, final int forks, final int calls) {
                  this.count = count;
                  this.recrusions = maxRecrusion;
                  this.forks = forks;
                  this.calls = calls;
              }

              @Override
              protected void compute() {
                  if (recrusions < 0) {
                      return;
                  }

                  final List<ForkJoinTask<Void>> forkedTasks = new ArrayList<>();
                  for (int i = 0; i < forks; i++) {
                      forkedTasks.add(new RecrusiveTask(count, recrusions - 1, forks, calls).fork());
                  }

                  for (int i = 0; i < calls; i++) {
                      count.increment();
                  }

                  for (final ForkJoinTask<Void> t : forkedTasks) {
                      t.join();
                  }
              }
          }

          public static void main(final String[] args) throws IOException, InterruptedException {
              for (int i = 0; i < 40; i++) {
                  final Thread t = new Thread(new Runnable() {

                      @Override
                      public void run() {
                          final Count count = new Count();
                          final RecrusiveTask recrusiveTask = new RecrusiveTask(count, 5, 10, 100);
                          new ForkJoinPool().submit(recrusiveTask).join();
                          System.out.println(String.format("Count %d", count.cnt));
                      }
                  });
                  t.start();
                  t.join();
                  System.out.println(String.format("Thread-%d finished.", i));
              }
          }
      }

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

        Activity

        Hide
        psonal Pallavi Sonal added a comment -
        To submitter:
        The bug has been reported for OpenJDK 8u121, can you please let us know if you are able to reproduce the issue on Oracle JDK as well?
        I tried approximately ten times on Windows as well as Linux with Oracle JDK8u121, but couldn’t reproduce the crash. What is the frequency of occurrence of the crash ?
        Show
        psonal Pallavi Sonal added a comment - To submitter: The bug has been reported for OpenJDK 8u121, can you please let us know if you are able to reproduce the issue on Oracle JDK as well? I tried approximately ten times on Windows as well as Linux with Oracle JDK8u121, but couldn’t reproduce the crash. What is the frequency of occurrence of the crash ?
        Hide
        psonal Pallavi Sonal added a comment -
        From submitter:
        I want to withdraw my bug report. It seems that my eclipse workspace is causing the crash, creating a new workspace solved the issue. Using the old workspace however I was able to reproduce the issue also with the oracle java 8 jdk.
        Show
        psonal Pallavi Sonal added a comment - From submitter: I want to withdraw my bug report. It seems that my eclipse workspace is causing the crash, creating a new workspace solved the issue. Using the old workspace however I was able to reproduce the issue also with the oracle java 8 jdk.
        Hide
        psonal Pallavi Sonal added a comment -
        Closing the issue as per submitter's response.
        Show
        psonal Pallavi Sonal added a comment - Closing the issue as per submitter's response.

          People

          • Assignee:
            psonal Pallavi Sonal
            Reporter:
            webbuggrp Webbug Group
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: