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

The try catch function is not getting executed when using newWorkStealingPool

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10

      Ryzen 7 2700X
      GTX 1070 ti

      java version "1.8.0_261"
      Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      If you try to submit a runnable with a try catch to a workstealer executorservice and there is an execption the exeption part wont be called.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create an executorservice from Executors.newWorkStealingPool . Submit a runnable which throws an error standing in a try catch clause. The try catch is crashing and not handling the execption.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The try catch clause shut execute the code standing in catch.
      ACTUAL -
      The try catch is not catching anything and does simly nothing.

      ---------- BEGIN SOURCE ----------
        ExecutorService executorService = Executors.newWorkStealingPool(3);
          executorService.submit(() -> {
            try {
              int thisShutThrowAnException = 0 / 0;
            } catch (Exception e) {
              System.out.println("Well I'm not getting executed");
              e.printStackTrace();
            }

          });
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              martin Martin Buchholz
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: