-
Notifications
You must be signed in to change notification settings - Fork 205
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
bugfix: Catch and log StackOverflowError #2001
Conversation
Previously, when the compiler threw a StackOverflowException Bloop would hang and nver return a results. Now, it logs the proper error and translates the exception. Related to VirtusLab/scala-cli#1781
@@ -133,6 +133,10 @@ final class BloopHighLevelCompiler( | |||
logger | |||
) | |||
} catch { | |||
case t: StackOverflowError => | |||
val msg = "Encountered StackOverflowError coming from the compiler. You might need to restart Bloop build server" | |||
logger.error(s"${msg}:\n${t.getStackTrace().mkString("\n")}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No supper happy about this, but it seems the loggers from zinc only allow a single message. This seems to be working alright when it comes to the example issue.
Question: Should we add a test case? This might be fixed in a future version of the compiler, so it would be removed at some point. Also, not sure if throwing stack overflow in a JVM is a best test case 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't really think we need to add a test for this.
backend/src/main/scala/sbt/internal/inc/bloop/internal/BloopHighLevelCompiler.scala
Outdated
Show resolved
Hide resolved
@@ -133,6 +133,10 @@ final class BloopHighLevelCompiler( | |||
logger | |||
) | |||
} catch { | |||
case t: StackOverflowError => | |||
val msg = "Encountered StackOverflowError coming from the compiler. You might need to restart Bloop build server" | |||
logger.error(s"${msg}:\n${t.getStackTrace().mkString("\n")}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't really think we need to add a test for this.
Co-authored-by: Chris Kipp <ckipp@pm.me>
Previously, when the compiler threw a StackOverflowException Bloop would hang and nver return a results. Now, it logs the proper error and translates the exception.
Related to VirtusLab/scala-cli#1781