2018-11-16 00:14:09 |
Tiago Stürmer Daitx |
bug |
|
|
added bug |
2018-11-16 00:23:26 |
Tiago Stürmer Daitx |
summary |
jtreg fails due to api incompatibility with openjdk-9 or later |
jtreg fails to run under openjdk-8 due to api incompatibility with openjdk-9 or later |
|
2018-11-16 00:25:41 |
Tiago Stürmer Daitx |
nominated for series |
|
Ubuntu Disco |
|
2018-11-16 00:25:41 |
Tiago Stürmer Daitx |
nominated for series |
|
Ubuntu Cosmic |
|
2018-11-16 00:34:38 |
Tiago Stürmer Daitx |
bug watch added |
|
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913853 |
|
2018-11-16 00:34:38 |
Tiago Stürmer Daitx |
bug task added |
|
jtreg (Debian) |
|
2018-11-16 00:35:31 |
Tiago Stürmer Daitx |
attachment added |
|
jtreg_4.2-b13-1_debdiff_4.2-b13-1ubuntu1.patch https://bugs.launchpad.net/debian/+source/jtreg/+bug/1803628/+attachment/5213237/+files/jtreg_4.2-b13-1_debdiff_4.2-b13-1ubuntu1.patch |
|
2018-11-16 00:35:59 |
Tiago Stürmer Daitx |
bug |
|
|
added subscriber Ubuntu Sponsors Team |
2018-11-16 00:36:16 |
Tiago Stürmer Daitx |
tags |
|
cosmic disco patch |
|
2018-11-16 01:17:34 |
Bug Watch Updater |
jtreg (Debian): status |
Unknown |
New |
|
2018-11-16 02:05:43 |
Michael Hudson-Doyle |
bug task added |
|
jtreg (Ubuntu Cosmic) |
|
2018-11-16 02:12:10 |
Tiago Stürmer Daitx |
description |
[Impact]
openjdk-9 introduced a few api changes that result in runtime errors when trying to run the java classes under openjdk 8 (or earlier) even when -source/-target are properly set.
The fix is to build such code using the new openjdk-9 flag "--release" instead of the "-source/-target" pair.
When running Cosmic's jtreg 4.2-b13-1 with agentvm under openjdk-8 it will fail and output a few lines such as:
stderr: Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main"
The java.lang.NoSuchMethodError is actually caused by "java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer" which can be easily solved by building jtreg with the "--release 7" argument.
[Test Case]
For this test case we need to create an empty TEST.ROOT file and a test class to satisfy jtreg requirements of a minimum test. jtreg must also be forced to use openjdk-8.
$ sudo apt install openjdk-8-jdk jtreg
$ touch TEST.ROOT
$ cat > Hello.java << EOF
/*
* @test
* @bug 2718282
* @summary Hello test
*/
public class Hello {
public static void main(String [] args) throws Exception {
if (true)
System.out.println("Hello World!");
else
throw new Exception("??");
}
}
EOF
$ JT_JAVA=/usr/lib/jvm/java-8-openjdk-amd64/ jtreg -va -agentvm Hello.java
[2018-11-15 23:42:34,720] Agent[0]: stderr:
[2018-11-15 23:42:34,721] Agent[0]: stderr: Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main"
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-8-openjdk-amd64
[snipped]
Test results: error: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
Error: Some tests failed or other problems occurred.
The expected response from jtreg does not contain the "stderr:" lines as in:
$ JT_JAVA=/usr/lib/jvm/java-8-openjdk-amd64/ jtreg -va -agentvm Hello.java
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-8-openjdk-amd64
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
Alternatively one can also check that openjdk-lts is not affected by the change, it should output the same before and after the fix:
$ sudo apt install openjdk-11-jdk
$ JT_JAVA=/usr/lib/jvm/java-11-openjdk-amd64/ jtreg -va -agentvm Hello.java
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-11-openjdk-amd64
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
[Regression Potential]
1. The --release argument is jdk9+ only, if jtreg is ever build with an older jdk it will FTBFS, so this change should only be backported on releases where the default-jdk is 9+.
2. The --release N argument is equivalent to setting -source N/-target N/-bootclasspath <N bootclasspath>, which can cause issues if the compiled classes use APIs that have been removed or are considered internal. The current jtreg version does not rely on internal classes from jdk 8 (otherwise it would FTBFS) but if a later version does that it will probably FTBFS - note that this is very unlikely as it would mean that upstream decided to break building jtreg with newer jdks.
[Other Info]
See https://github.com/apache/felix/pull/114 for a good overview on the methods that changed on OpenJDK 9 and a better description on the cause. Note that they propose patching the methods to cast ByteBuffer to Buffer when calling the affected methods, but this can be easily prevented by using the --release argument instead. |
[Impact]
openjdk-9 introduced a few api changes that result in runtime errors when trying to run the java classes under openjdk 8 (or earlier) even when -source/-target are properly set.
The fix is to build such code using the new openjdk-9 flag "--release" instead of the "-source/-target" pair.
When running Cosmic's jtreg 4.2-b13-1 with agentvm under openjdk-8 it will fail and output a few lines such as:
stderr: Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main"
The java.lang.NoSuchMethodError is actually caused by "java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer" which can be easily solved by building jtreg with the "--release 7" argument.
This affects the openjdk-8 build in Cosmic as the jtreg testsuites are run as part of the build. We use the test results for checking regressions from an update.
[Test Case]
For this test case we need to create an empty TEST.ROOT file and a test class to satisfy jtreg requirements of a minimum test. jtreg must also be forced to use openjdk-8.
$ sudo apt install openjdk-8-jdk jtreg
$ touch TEST.ROOT
$ cat > Hello.java << EOF
/*
* @test
* @bug 2718282
* @summary Hello test
*/
public class Hello {
public static void main(String [] args) throws Exception {
if (true)
System.out.println("Hello World!");
else
throw new Exception("??");
}
}
EOF
$ JT_JAVA=/usr/lib/jvm/java-8-openjdk-amd64/ jtreg -va -agentvm Hello.java
[2018-11-15 23:42:34,720] Agent[0]: stderr:
[2018-11-15 23:42:34,721] Agent[0]: stderr: Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main"
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-8-openjdk-amd64
[snipped]
Test results: error: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
Error: Some tests failed or other problems occurred.
The expected response from jtreg does not contain the "stderr:" lines as in:
$ JT_JAVA=/usr/lib/jvm/java-8-openjdk-amd64/ jtreg -va -agentvm Hello.java
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-8-openjdk-amd64
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
Alternatively one can also check that openjdk-lts is not affected by the change, it should output the same before and after the fix:
$ sudo apt install openjdk-11-jdk
$ JT_JAVA=/usr/lib/jvm/java-11-openjdk-amd64/ jtreg -va -agentvm Hello.java
--------------------------------------------------
TEST: Hello.java
TEST JDK: /usr/lib/jvm/java-11-openjdk-amd64
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/html/report.html
Results written to /tmp/JTwork
[Regression Potential]
1. The --release argument is jdk9+ only, if jtreg is ever build with an older jdk it will FTBFS, so this change should only be backported on releases where the default-jdk is 9+.
2. The --release N argument is equivalent to setting -source N/-target N/-bootclasspath <N bootclasspath>, which can cause issues if the compiled classes use APIs that have been removed or are considered internal. The current jtreg version does not rely on internal classes from jdk 8 (otherwise it would FTBFS) but if a later version does that it will probably FTBFS - note that this is very unlikely as it would mean that upstream decided to break building jtreg with newer jdks.
[Other Info]
See https://github.com/apache/felix/pull/114 for a good overview on the methods that changed on OpenJDK 9 and a better description on the cause. Note that they propose patching the methods to cast ByteBuffer to Buffer when calling the affected methods, but this can be easily prevented by using the --release argument instead. |
|
2018-11-16 03:06:39 |
Launchpad Janitor |
jtreg (Ubuntu): status |
New |
Fix Released |
|
2018-11-16 11:17:16 |
Timo Aaltonen |
jtreg (Ubuntu Cosmic): status |
New |
Fix Committed |
|
2018-11-16 11:17:18 |
Timo Aaltonen |
bug |
|
|
added subscriber Ubuntu Stable Release Updates Team |
2018-11-16 11:17:20 |
Timo Aaltonen |
bug |
|
|
added subscriber SRU Verification |
2018-11-16 11:17:22 |
Timo Aaltonen |
tags |
cosmic disco patch |
cosmic disco patch verification-needed verification-needed-cosmic |
|
2018-11-16 14:50:59 |
Tiago Stürmer Daitx |
tags |
cosmic disco patch verification-needed verification-needed-cosmic |
cosmic disco patch verification-done-cosmic |
|
2018-11-19 17:13:42 |
Launchpad Janitor |
jtreg (Ubuntu Cosmic): status |
Fix Committed |
Fix Released |
|
2018-11-23 11:54:38 |
Bug Watch Updater |
jtreg (Debian): status |
New |
Fix Released |
|
2018-12-05 15:47:08 |
Tiago Stürmer Daitx |
nominated for series |
|
Ubuntu Bionic |
|
2018-12-05 15:47:08 |
Tiago Stürmer Daitx |
bug task added |
|
jtreg (Ubuntu Bionic) |
|
2019-02-02 23:23:19 |
Mathew Hodson |
jtreg (Ubuntu): importance |
Undecided |
Medium |
|
2019-02-02 23:23:22 |
Mathew Hodson |
jtreg (Ubuntu Bionic): importance |
Undecided |
Medium |
|
2019-02-02 23:23:24 |
Mathew Hodson |
jtreg (Ubuntu Cosmic): importance |
Undecided |
Medium |
|
2019-02-21 12:58:36 |
Łukasz Zemczak |
jtreg (Ubuntu Bionic): status |
New |
Fix Committed |
|
2019-02-21 12:58:41 |
Łukasz Zemczak |
tags |
cosmic disco patch verification-done-cosmic |
cosmic disco patch verification-done-cosmic verification-needed verification-needed-bionic |
|
2019-02-21 15:27:01 |
Tiago Stürmer Daitx |
tags |
cosmic disco patch verification-done-cosmic verification-needed verification-needed-bionic |
cosmic disco patch verification-done-bionic verification-done-cosmic |
|
2019-03-08 05:46:09 |
Mathew Hodson |
bug task added |
|
jtreg (Ubuntu Disco) |
|
2019-04-16 16:33:38 |
Launchpad Janitor |
jtreg (Ubuntu Bionic): status |
Fix Committed |
Fix Released |
|