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

Scala scripts can throw JVM error if extra files placed in SCALA_HOME/lib #8967

Closed
scabug opened this issue Nov 7, 2014 · 11 comments
Closed

Comments

@scabug
Copy link

scabug commented Nov 7, 2014

I get the following error when I try to run the Scala 2.11.2 and 2.11.4 REPL or compile with scalac:

java.lang.ClassNotFoundException                                                                                         
 - klass: 'java/lang/ClassNotFoundException'                                                                             
#                                                                                                                        
# A fatal error has been detected by the Java Runtime Environment:                                                       
#                                                                                                                        
#  Internal Error (exceptions.cpp:424), pid=28245, tid=140376925402880                                                   
#  fatal error: ExceptionMark destructor expects no pending exceptions                                                   
#                                                                                                                        
# JRE version: Java(TM) SE Runtime Environment (7.0_72-b14) (build 1.7.0_72-b14)                                         
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.72-b04 mixed mode linux-amd64 compressed oops)                          
# Failed to write core dump. 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:
# /home/burgosr/pt-tests/hs_err_pid28245.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
/home/burgosr/Scala/scala-2.11.2/bin/scala: line 21: 28245 Aborted                 (core dumped) "$@"

I see this error in two different machines. Interestingly, I can run 2.11.2 and 2.11.4 REPLs within sbt without any problems, and I can compile projects within an IDE as well. I also don't see this error using Scala 2.11.1 and below.

Additionally, scala -nobootcp and scalac -nobootcp does work for both version. This was suggested by Paul Phillips in #4433.

@scabug
Copy link
Author

scabug commented Nov 7, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8967?orig=1
Reporter: Roberto Burgos (rburgosnavas)
Affected Versions: 2.11.2, 2.11.4
Attachments:

@scabug
Copy link
Author

scabug commented Nov 7, 2014

@retronym said (edited on Nov 7, 2014 9:35:42 PM UTC):
Can you try:

  • /usr/lib/jvm/jdk1.7.0_72/bin/java -version
  • reinstalling the JDK?

@scabug
Copy link
Author

scabug commented Nov 7, 2014

Roberto Burgos (rburgosnavas) said:
I have tried with 1.7.0_72 and two other version prior, and I have tried reinstalling the JDK a couple of times.

@scabug
Copy link
Author

scabug commented Nov 7, 2014

@retronym said:
Could you please post a transcript like this one?

https://gist.github.com/retronym/b772110734be22f0456a

@scabug
Copy link
Author

scabug commented Nov 7, 2014

Roberto Burgos (rburgosnavas) said (edited on Nov 8, 2014 12:02:07 AM UTC):
Attached files as requested.

@scabug
Copy link
Author

scabug commented Nov 8, 2014

@retronym said:
One more diagnostic:

% for f in $(echo /home/burgosr/Scala/scala-2.11.4/lib/akka-actor_2.11-2.3.4.jar:/home/burgosr/Scala/scala-2.11.4/lib/ant:/home/burgosr/Scala/scala-2.11.4/lib/config-1.2.1.jar:/home/burgosr/Scala/scala-2.11.4/lib/forkjoin.jar.desired.sha1:/home/burgosr/Scala/scala-2.11.4/lib/jline-2.12.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-2.11.0.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-migration_2.11-1.1.0.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-compiler.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-library_2.11-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-plugin_2.11.4-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-library.jar:/home/burgosr/Scala/scala-2.11.4/lib/scalap-2.11.4.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-parser-combinators_2.11-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-reflect.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-swing_2.11-1.0.1.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-xml_2.11-1.0.2.jar | tr ':' ' '); do echo $f; file $f; done

@scabug
Copy link
Author

scabug commented Nov 8, 2014

Roberto Burgos (rburgosnavas) said:

for f in $(echo /home/burgosr/Scala/scala-2.11.4/lib/akka-actor_2.11-2.3.4.jar:/home/burgosr/Scala/scala-2.11.4/lib/ant:/home/burgosr/Scala/scala-2.11.4/lib/config-1.2.1.jar:/home/burgosr/Scala/scala-2.11.4/lib/forkjoin.jar.desired.sha1:/home/burgosr/Scala/scala-2.11.4/lib/jline-2.12.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-2.11.0.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-migration_2.11-1.1.0.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-compiler.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-library_2.11-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-plugin_2.11.4-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-library.jar:/home/burgosr/Scala/scala-2.11.4/lib/scalap-2.11.4.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-parser-combinators_2.11-1.0.2.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-reflect.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-swing_2.11-1.0.1.jar:/home/burgosr/Scala/scala-2.11.4/lib/scala-xml_2.11-1.0.2.jar | tr ':' ' '); do echo $f; file $f; done
/home/burgosr/Scala/scala-2.11.4/lib/akka-actor_2.11-2.3.4.jar
/home/burgosr/Scala/scala-2.11.4/lib/akka-actor_2.11-2.3.4.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/ant
/home/burgosr/Scala/scala-2.11.4/lib/ant: directory 
/home/burgosr/Scala/scala-2.11.4/lib/config-1.2.1.jar
/home/burgosr/Scala/scala-2.11.4/lib/config-1.2.1.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/forkjoin.jar.desired.sha1
/home/burgosr/Scala/scala-2.11.4/lib/forkjoin.jar.desired.sha1: ASCII text
/home/burgosr/Scala/scala-2.11.4/lib/jline-2.12.jar
/home/burgosr/Scala/scala-2.11.4/lib/jline-2.12.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-2.11.0.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-2.11.0.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-migration_2.11-1.1.0.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-actors-migration_2.11-1.1.0.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-compiler.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-compiler.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-library_2.11-1.0.2.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-library_2.11-1.0.2.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-plugin_2.11.4-1.0.2.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-continuations-plugin_2.11.4-1.0.2.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-library.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-library.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scalap-2.11.4.jar
/home/burgosr/Scala/scala-2.11.4/lib/scalap-2.11.4.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-parser-combinators_2.11-1.0.2.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-parser-combinators_2.11-1.0.2.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-reflect.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-reflect.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-swing_2.11-1.0.1.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-swing_2.11-1.0.1.jar: Java Jar file data (zip)
/home/burgosr/Scala/scala-2.11.4/lib/scala-xml_2.11-1.0.2.jar
/home/burgosr/Scala/scala-2.11.4/lib/scala-xml_2.11-1.0.2.jar: Java Jar file data (zip)

@scabug
Copy link
Author

scabug commented Nov 8, 2014

@retronym said:
My hunch is that this is a file permissions problem somewhere, but I can't see where that might be.

A similar symptom was reported here: https://trac.macports.org/ticket/30550

I suspect that the error reporting in the JDK is poor when it comes to problems like this on the boot classpath.

To troubleshoot this theory, you could run the java .... command under strace to trace the system calls.

Here's what I see doing that (using dtruss on Mac): https://gist.github.com/retronym/0542fc2f4c70c39843d8

@scabug
Copy link
Author

scabug commented Nov 8, 2014

@retronym said:
Another suspicious part is: /home/burgosr/Scala/scala-2.11.4/lib/forkjoin.jar.desired.sha1. That file is not in the standard distribution: https://www.dropbox.com/s/8lt4vbm65n5mlz1/Screenshot%202014-11-08%2010.31.56.png?dl=0

@scabug
Copy link
Author

scabug commented Nov 8, 2014

Roberto Burgos (rburgosnavas) said:
Your second suspicion nailed it. I downloaded the binaries scala-2.11.4.tgz and the sources scala-sources-2.11.4.tar.gz, and when extracted, they lived in the same root folder '/scala-2.11.4'. "forkjoin.jar.desired.sha1" is part of the scala-sources-2.11.4.tar.gz.

Anyway, I extracted a fresh copy of 2.11.4 (no sources!) and the REPL and scalac work fine.

@scabug
Copy link
Author

scabug commented Nov 8, 2014

@retronym said:
I've made the scripts more robust: http://github.com/scala/scala/pull/4113

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

No branches or pull requests

2 participants