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

bugfix: Catch and log StackOverflowError #2001

Merged
merged 2 commits into from
Feb 2, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Jan 30, 2023

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

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
@tgodzik tgodzik requested a review from ckipp01 January 30, 2023 17:34
@@ -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")}")
Copy link
Contributor Author

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 😅

Copy link
Member

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.

@@ -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")}")
Copy link
Member

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>
@tgodzik tgodzik requested a review from ckipp01 February 1, 2023 17:07
@tgodzik tgodzik merged commit a249e0a into scalacenter:main Feb 2, 2023
@tgodzik tgodzik deleted the catch-and-log-stackoverflow branch February 2, 2023 12:21
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

Successfully merging this pull request may close these issues.

2 participants