Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotty exception starting in JDK21-b21 #384

Closed
ericcaspole opened this issue May 5, 2023 · 5 comments · Fixed by #407
Closed

Dotty exception starting in JDK21-b21 #384

ericcaspole opened this issue May 5, 2023 · 5 comments · Fixed by #407
Assignees
Labels
compatibility Relates to platform or system compatibility

Comments

@ericcaspole
Copy link

ericcaspole commented May 5, 2023

Starting in JDK-21-b21, due to this fix https://bugs.openjdk.org/browse/JDK-8292275 Dotty fails to run in 0.14.1. and 0.14.2.

I don't know much about Scala or Dotty, thanks for your analysis.

jdks/21-b21/Contents/Home/bin/java -jar renaissance-jmh-0.14.2.jar Dotty -t 1 -i 15 -wi 75 -f 1
# JMH version: 1.34
# VM version: JDK 21-ea, Java HotSpot(TM) 64-Bit Server VM, 21-ea+21-LTS-1778
# VM invoker: /Users/ecaspole/dev/opt/brunte/jdks/21-b21/Contents/Home/bin/java
# VM options: <none>
# Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
# Warmup: 75 iterations, single-shot each
# Measurement: 15 iterations, single-shot each
# Timeout: 10 min per iteration
# Threads: 1 thread
# Benchmark mode: Single shot invocation time
# Benchmark: org.renaissance.scala.dotty.JmhDotty.runOperation

# Run progress: 0.00% complete, ETA 00:00:00
# Fork: 1 of 1
# Warmup Iteration   1: dotty-error: error while loading ElementType,
class file /modules/java.base/java/lang/annotation/ElementType.class is broken, reading aborted with class java.lang.RuntimeException
bad constant pool index: 0 at pos: 1220
<failure>

org.renaissance.BenchmarkResult$ValidationException: compilation errors: expected 0 but got 1
	at org.renaissance.BenchmarkResult$Assert.assertEquals(BenchmarkResult.java:167)
	at org.renaissance.scala.dotty.Dotty.$anonfun$run$1(Dotty.scala:228)
	at org.renaissance.jmh.JmhRenaissanceBenchmark.tearDownOperation(JmhRenaissanceBenchmark.java:135)
	at org.renaissance.scala.dotty.jmh_generated.JmhDotty_runOperation_jmhTest.runOperation_SingleShotTime(JmhDotty_runOperation_jmhTest.java:510)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:475)
	at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:458)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)




# Run complete. Total time: 00:00:03
@lbulej
Copy link
Member

lbulej commented May 10, 2023

Thanks for the report, noted. I have no idea what Scala or Dotty is doing either, but apparently they are trying to read class files and encounter something unexpected in the class file content due to the change. In either case, this will require updating Dotty (if this is fixed upstream), which may require more than a simple version bump in the dependencies, so it might take some time. We may need to mark the benchmark as incompatible with JDK21 for the time being (similar to what we'll probably have to do with Spark until version 3.5 is released).

@lbulej lbulej added the compatibility Relates to platform or system compatibility label May 17, 2023
lbulej added a commit that referenced this issue May 17, 2023
Changes in JDK21 break apache-spark benchmarks and the scala-dotty
benchmark (see #370 and #384). With the apache-spark benchmarks, we
are waiting for a fix that is expected to appear in Spark 3.5. With
the scala-dotty benchmark, we need to check if the issue is handled
upstream. For the time being (to allow including JDK21 in the CI
testing matrix), we will restrict the supported JVM in these benchmark
to JDK20.
@parttimenerd
Copy link
Contributor

This is related to scala/scala3#17536 and fixed in main, probably shipped in 3.3.1.

@lbulej
Copy link
Member

lbulej commented May 24, 2023

This is related to lampepfl/dotty#17536 and fixed in main, probably shipped in 3.3.1.

Thanks for the heads up, I'll start looking into updating dotty so that when they make the upstream release, we can just bump to that version.

@bulasevich
Copy link

Hi,

Yes, the issue was fixed in lampepfl v3.3.1.
scala3-compiler update requires scalaVersion update:

diff --git a/build.sbt b/build.sbt
index 8613a311..81c62b4b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -60,7 +60,7 @@ ThisBuild / Compile / scalacOptions += "-target:jvm-1.8"
 ThisBuild / git.useGitDescribe := true

 val scalaVersion212 = "2.12.15"
-val scalaVersion213 = "2.13.8"
+val scalaVersion213 = "2.13.11"

 val modulesPropertiesName = "modules.properties"
 val benchmarksPropertiesName = "benchmarks.properties"
@@ -346,7 +346,7 @@ lazy val scalaDottyBenchmarks = (project in file("benchmarks/scala-dotty"))
     scalaVersion := scalaVersion213,
     scalacOptions += "-Ytasty-reader",
     libraryDependencies ++= Seq(
-      "org.scala-lang" % "scala3-compiler_3" % "3.0.2",
+      "org.scala-lang" % "scala3-compiler_3" % "3.3.1-RC1",
       // The following is required to compile the workload sources.
       "org.scala-lang" % "scala-compiler" % scalaVersion.value
     ),

However, this simple change introduces another build problem. I would appreciate it if someone would look into this.

[error] renaissance/benchmarks/scala-dotty/src/main/scala/org/renaissance/scala/dotty/Dotty.scala:202:61: Unsupported Scala 3 union in parameter value reporter; found in method process in class dotty.tools.dotc.Driver.
[error]   override def run(bc: BenchmarkContext): BenchmarkResult = {
[error]                                                             ^
[error] one error found
[error] (scalaDottyBenchmarks / Compile / compileIncremental) Compilation failed

@lbulej
Copy link
Member

lbulej commented Jul 7, 2023

However, this simple change introduces another build problem. I would appreciate it if someone would look into this.

It's a bit of a dependency hell — the Dotty update is among targets for the next release to ensure compatibility with latest JDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Relates to platform or system compatibility
Projects
None yet
4 participants