-
Notifications
You must be signed in to change notification settings - Fork 21
NullPointerException on JDK 17 involving MODULE$
in scala-library 2.12
#13023
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
Comments
seems like something you could check, in both 2.12 and 2.13, with |
Note that |
Seth, thank you for your fast response!
Unfortunately
|
|
Note that the companion for |
som-snytt, thanks for confirming the different behavior between Scala 2.12 and 2.13.
Also thanks for your input! I'm able to confirm that the MODULE$ fields are
Given that MODULE$ is assigned in the instance initializer in 2.12, this might explain why JIT is able to swap it from non-null to null on the fly. |
closing since the problem presumably doesn't exist on 2.13, and we don't keep 2.12-only tickets open. but discussion can continue |
MODULE$
in scala-library 2.12
For further discussion, please leverage the following thread. |
Reproduction steps
Over the past few months, we have observed transient issues where NullPointerException (i.e., NPE) is thrown by methods of "$.MODULE$" in scala-library when running our short-lived Spark apps on multiple AWS EMR 7 clusters with Java 17 runtime. It's neither cluster specific nor host type specific. Note that everything works when re-running the same app on the same cluster (with the same worker nodes) after the initial failure due to NPE. In other words, we're unable to reproduce the issue at will. To mitigate the issue, we had to disable C2 and only use C1 with no profiling overhead via
-XX:+TieredCompilation -XX:TieredStopAtLevel=1
.Scala version: Scala version 2.12.17 (OpenJDK 64-Bit Server VM, Java 17.0.12)
Problem
Various methods of "$.MODULE$" in scala-library throw NullPointerException in a random way (Scala version 2.12, OpenJDK 64-Bit Server VM, Java 17.0.12). The issues are observed on worker nodes with high CPU utilization (p90 utilization >90%), but we're not sure if the hot CPU plays a role there. Our hypothesis is that NPE might be caused by JIT compiler optimization that incorrectly removes the assignment of a certain variable from some code path, similar to this bug. I won't expect that JIT will change any static final field from non-null to null within the same JVM process though.
Here's the question: are those "$.MODULE$" fields implemented as
static final
fields in Scala 2.12? If not, do we expect them to bestatic final
in Scala 2.13 after addressing scala/scala-dev#537?The text was updated successfully, but these errors were encountered: