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

On a clean 2.13.x, scalacheck/test crashes JVM 18 #815

Closed
som-snytt opened this issue Aug 29, 2022 · 7 comments
Closed

On a clean 2.13.x, scalacheck/test crashes JVM 18 #815

som-snytt opened this issue Aug 29, 2022 · 7 comments

Comments

@som-snytt
Copy link

som-snytt commented Aug 29, 2022

On a clean 2.13.x, scalacheck/test crashes JVM 18.0.[12].1 [EDITED]

From the hs_err.log

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fad5f9c03fc, pid=30176, tid=30206
#
# JRE version: OpenJDK Runtime Environment (18.0.1.1+2) (build 18.0.1.1+2-6)
# Java VM: OpenJDK 64-Bit Server VM (18.0.1.1+2-6, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd263fc]  SubTypeCheckNode::sub(Type const*, Type const*) const+0x26c

Current thread (0x00007facd0044600):  JavaThread "C2 CompilerThread2" daemon [_thread_in_native, id=30206, stack(0x00007facfb2eb000,0x00007facfb3ec000)]


Current CompileTask:
C2:   6825 9226       4       scala.collection.ArrayOps$::prepended$extension (48 bytes)

Stack: [0x00007facfb2eb000,0x00007facfb3ec000],  sp=0x00007facfb3e7850,  free space=1010k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xd263fc]  SubTypeCheckNode::sub(Type const*, Type const*) const+0x26c
V  [libjvm.so+0xc42b1c]  PhaseIterGVN::transform_old(Node*)+0x12c
V  [libjvm.so+0xc3f658]  PhaseIterGVN::optimize()+0x118
V  [libjvm.so+0x5b0d2b]  Compile::Optimize()+0x128b
V  [libjvm.so+0x5b21d8]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xe78
V  [libjvm.so+0x4f4b01]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x101
V  [libjvm.so+0x5bab58]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xca8
V  [libjvm.so+0x5bb6f8]  CompileBroker::compiler_thread_loop()+0x4f8
V  [libjvm.so+0xd93622]  JavaThread::thread_main_inner()+0xc2
V  [libjvm.so+0xd977d0]  Thread::call_run()+0xc0
V  [libjvm.so+0xbfc0b1]  thread_native_entry(Thread*)+0xe1


siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

From the replay.log

instanceKlass scala/collection/ArrayOps$
***
compile scala/collection/ArrayOps$ prepended$extension (Ljava/lang/Object;Ljava/lang/Object;Lscala/reflect/ClassTag;)Ljava/lang/Object; -1 4 inline 13 0 -1 0 scala/collection/ArrayOps$ prepended$extension (Ljava/lang/Object;Ljava/lang/Object;Lscala/reflect/ClassTag;)Ljava/lang/Object; 1 5 0 scala/runtime/ScalaRunTime$ array_length (Ljava/lang/Object;)I 1 10 0 scala/reflect/ManifestFactory$IntManifest newArray (I)Ljava/lang/Object; 2 2 0 scala/reflect/ManifestFactory$IntManifest newArray (I)[I 1 10 0 scala/reflect/ManifestFactory$AnyManifest newArray (I)Ljava/lang/Object; 2 2 0 scala/reflect/ManifestFactory$AnyManifest newArray (I)[Ljava/lang/Object; 1 24 0 scala/runtime/ScalaRunTime$ array_update (Ljava/lang/Object;ILjava/lang/Object;)V 2 50 0 scala/runtime/BoxesRunTime unboxToInt (Ljava/lang/Object;)I 3 12 0 java/lang/Integer intValue ()I 2 174 0 scala/runtime/BoxesRunTime unboxToChar (Ljava/lang/Object;)C 3 12 0 java/lang/Character charValue ()C 1 39 0 scala/runtime/ScalaRunTime$ array_length (Ljava/lang/Object;)I 1 42 0 scala/Array$ copy (Ljava/lang/Object;ILjava/lang/Object;II)V
@SethTisue
Copy link
Member

SethTisue commented Aug 31, 2022

(thanks for the report)

I'm not able to reproduce the problem on Eclipse Adoptium Java 18.0.2.1 (MacOS, ARM64 build)

Are you able to upgrade to 18.0.2 and see if the problem goes away for you...?

@ashawley
Copy link
Member

Seth has a good hunch. Release notes for 18.0.2.1 says it fixed a "C2 crash":

https://bugs.openjdk.org/browse/JDK-8292260

@som-snytt
Copy link
Author

som-snytt commented Sep 3, 2022

I reported the wrong range.

               | >>> | 18.0.2.1     | open    | installed  | 18.0.2.1-open
               |     | 18.0.1.1     | open    | local only | 18.0.1.1-open

Thanks for the bug link. It's suspicious that it is array-alloc related.

Noticed at scala/scala#10083 (comment) where the PR build was failing. At first, I wondered if I had done something to make scalacheck shrinking fail.

@som-snytt
Copy link
Author

It's after restarrFull:

sbt:root> restarrFull
[info] *** Welcome to the sbt build definition for Scala! ***
[info] version=2.13.9-bin-d578a02-SNAPSHOT scalaVersion=2.13.8
[info] Check README.md for more information.
[success] Total time: 0 s, completed Sep 2, 2022, 8:05:30 PM
[info] Wrote ***scala/target/library/scala-library-2.13.9-bin-d578a02-SNAPSHOT.pom
[snip]
[info] + Range inclusiveByOne.init: OK, passed 100 tests.
[info] Elapsed time: 0.001 sec
[info] + Range inclusiveByOne.takeWhile: OK, passed 100 tests.
[info] Elapsed time: 0.002 sec
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ff7aa570acc, pid=6145, tid=6173
#
# JRE version: OpenJDK Runtime Environment (18.0.2.1+1) (build 18.0.2.1+1-1)
# Java VM: OpenJDK 64-Bit Server VM (18.0.2.1+1-1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd27acc][info] + Range inclusiveByOne.tails: OK, passed 100 tests.
[info] Elapsed time: 0.011 sec
  SubTypeCheckNode::sub(Type const*, Type const*) const+0x26c
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# ***scala/test/scalacheck/hs_err_pid6145.log
[info] + Range inclusiveByOne.inits: OK, passed 100 tests.
[info] Elapsed time: 0.027 sec
[info] + Range inclusiveByOne.reverse.toSet.equal: OK, passed 100 tests.
[info] Elapsed time: 0.004 sec
[info] + Range inclusiveByOne.grouped: OK, passed 100 tests.
[info] Elapsed time: 0.005 sec
[info] + pattern deconstruction.extract bind: OK, passed 100 tests.
[info] Elapsed time: 0.090 sec
#
# Compiler replay data is saved as:
# ***scala/test/scalacheck/replay_pid6145.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
[error] Error: Total 0, Failed 0, Errors 0, Passed 0
[error] Error during tests:
[error]         sbt.ForkMain 42243 failed with exit code 134
[error] (scalacheck / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 129 s (02:09), completed Sep 2, 2022, 8:08:06 PM
sbt:root>

@SethTisue
Copy link
Member

SethTisue commented Sep 8, 2022

Indeed, I can now reproduce it on my Mac, on "OpenJDK 64-Bit Server VM Temurin-18.0.2.1+1 (build 18.0.2.1+1, mixed mode)". I did a clean checkout of 2.13.x and ran sbt, then restarrFull followed by scalacheck/test.

Seems like minimizing this could be a Herculean task. (Though perhaps the JDK developers could work with just a crash log...)

@lrytz
Copy link
Member

lrytz commented Sep 8, 2022

Minimizing would be nice, but it's not hard to reproduce so it would be worth reporting. https://bugreport.java.com/bugreport/crash_report.do is the official channel, though pinging people directly worked better in the past.

Could you try other builds and versions, like OpenJDK, 19 / 20 EA-Builds?

@SethTisue
Copy link
Member

A month or two passes, and already JDK 18 is like tears in rain.

The problem does not reproduce for me on JDK 19 (openjdk version "19" 2022-09-20 OpenJDK Runtime Environment Temurin-19+36 (build 19+36)).

I didn't try a newer build of 18, but, closing regardless, as 18 lacks an LTS star on its belly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants