JDK-8295930 : Results are different when hotspot and openj9 call "wait" in the Object class
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2022-10-25
  • Updated: 2022-10-26
  • Resolved: 2022-10-26
Related Reports
Duplicate :  
Description
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



Comments
This is actually a bug that was fixed in JDK 12. It could be backported to 8u and 11u. Closing as a duplicate of JDK-8210787.
26-10-2022

Issue is not reproduced with OracleJDK OS: Linux Ubuntu JDK 8u351: Pass java.lang.IllegalArgumentException is correctly thrown for OracleJDK. Submitter should file an issue with eclipse for OpenJ9
26-10-2022