Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the Error: "org.jetbrains.jps.incremental.scala.remote.ServerException java.lang.StackOverflowError"

I'm trying to run the main class in the scala-sbt project. Running the class is resulting in stackoverflow Error, StackTrace pasted below.

I am sure this is not a code Issue because for the same project I was able to run sbt package by setting the memory in sbt conf file as described here: https://stackoverflow.com/q/55874883.

I tried to set the params in Intellij> Settings> Scala Compile Server, but it didn't help to overcome Error. JDK: Profile Default Jvm maximum heap size, MB: 2024 JVM options: -server -Xmx2G -Xss20m -XX:MaxPermSize=1000m -XX:ReservedCodeCacheSize=1000m

IntelliJ: IntelliJ IDEA 2019.1 (Community Edition) Build #IC-191.6183.87, built on March 27, 2019 JRE: 1.8.0_202-release-1483-b39 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

Sbt Version: 1.2.8

Scala Version: 2.11.8

Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
java.lang.StackOverflowError

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:273)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:209)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.noTailTransform(TailCalls.scala:214)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:403)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:209)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.noTailTransform(TailCalls.scala:214)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:403)

    at scala.tools.nsc.transform.TailCalls$TailCallElimination.transform(TailCalls.scala:209)

    redacted...

like image 210
Pavan_Obj Avatar asked May 09 '19 20:05

Pavan_Obj


2 Answers

I've had the same issue with Intellij IDEA Ultimate 2020.1.1.

None of above options worked for me. But with a hint of the above answer, I found there was also different setting for the Scala compiler, after changing it the error stopped.

I increased the size of stack trace of the Scala compiler server: Preferences -> Compiler -> Scala Compiler -> Scala Compiler Server. Then, change the JVM options accordingly (In my case, -server -Xss1024m).

like image 58
Sonia Avatar answered Oct 02 '22 12:10

Sonia


I've had the same issue with Intellij IDEA Community Edition 2019.3.4.

In the end, what worked for me was this solution. Basically, go to Settings -> Build, Execution, Deployment -> Compiler

Then, on "User-local build process VM options" set the stack size to a greater value with -Xss

In my case, I finally managed to run the tests setting it to -Xss2048m

I hope this helps.

like image 38
Jaime Caffarel Avatar answered Oct 02 '22 13:10

Jaime Caffarel