Stack overflows kills Unity
saikyun opened this issue · comments
Steps to reproduce:
user=> (defn yeah [a] (+ a (yeah a)))
#'user/yeah
user=> (yeah 1)
System.StackOverflowException: The requested operation caused a stack overflow.
* user/yeah
In file: user=> 1
This isn't reproducible on my REPL (socket, macOS). Ramsey is seeing it on Linux however, with both nREPL and the socket REPL. What OS are you on @saikyun ?
Actually even on mine evaluating (try (yeah 1) (catch Exception e "caught"))
a couple of times crashes Unity on the fourth try
This seems to be a weird quirk of the CLR itself. Looks like StackOverflowExceptions are uncatchable and will kill the process, and this behavior is built into the VM itself.
https://stackoverflow.com/questions/44534323/handling-exceptions-in-unity/44553186#44553186
As hard as a StackOverflow post on Stack Overflows is to top, here is the canonical documentation: https://docs.microsoft.com/en-us/dotnet/api/system.stackoverflowexception?redirectedfrom=MSDN&view=netframework-4.7.2#remarks