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

Results are different when hotspot and openj9 call "wait" in the Object class

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 18.04 x86_64

      A DESCRIPTION OF THE PROBLEM :
      As shown below, when the "wait (long time, int frac)" method is called with time=long. MAX_ VALUE and frac>0 (for example, "1"), HotSpot will capture IllegalArgumentException, while openj9 will not.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please use HotSpot (jdk8/jdk11) to compile and run the following test case.




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The output is empty.
      ACTUAL -
      Exception in thread "main" java.lang.RuntimeException: Unexpected
      at org.example.WaitTooLong.test(WaitTooLong.java:10)
      at org.example.WaitTooLong.main(WaitTooLong.java:3)
      Caused by: java.lang.IllegalArgumentException: timeout value is negative
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Object.java:460)
      at org.example.WaitTooLong.test(WaitTooLong.java:7)
      ... 1 more

      ---------- BEGIN SOURCE ----------
      public class WaitTooLong {
          public static void main(String[] args) {
              test(1);
          }
          static void test(int nanos) {
              try {
                  WaitTooLong.class.wait(Long.MAX_VALUE, nanos);
              } catch (IllegalMonitorStateException expected) {
              } catch (IllegalArgumentException | InterruptedException unexpected) {
                  throw new RuntimeException("Unexpected", unexpected);
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            sswsharm swati sharma (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: