On Tue, Apr 5, 2022 at 6:18 PM ben...@gmail.com <benh...@gmail.com> wrote:

> Normally the Go Playground gives errors when a runtime panic or other
> error occurs, including "timeout running program" for programs that run too
> long. I'm wondering why the Playground doesn't show a stack overflow error
> (or any error) for this infinitely-recursing program?
>
> https://go.dev/play/p/ILbGVj0dfWg
>
> It seems like a quirk (bug?) in the way this particular error is handled.
> This confused my colleague (who's new to Go) because he (correctly)
> expected it to show some kind of overflow/recursion error.
>
> For comparison, here's what the Go runtime says locally for this code:
>
> $ go run t.go
> runtime: goroutine stack exceeds 1000000000-byte limit
> runtime: sp=0xc020160398 stack=[0xc020160000, 0xc040160000]
> fatal error: stack overflow
> ... full stack trace elided ...
>
> Should I report a golang/go issue?
>

In addition to what Ian said  I'll point out that this is a borderline HCF
(halt-catch-fire) situation. In other words, I'm pretty sure infinite
recursion is not guaranteed to result in the specific fatal error you
observed on whatever platform you ran `go run t.go`. Your system might just
as well failed with a kernel panic. Yes, that would be unlikely on any OS
supported by Go but, I'm pretty sure, is allowed to occur. Feel free to
point me to the portion of the Go specification which contradicts what I
just wrote. :-)

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD84w3H524zsMks9bEU%2BNRQKzms4Fs%3DN%3DQHxBjjYL74AjA%40mail.gmail.com.

Reply via email to