Description
I don't know if there's anything GopherJS can do about this or not, but if so, it would have saved me several hours of debugging this afternoon.
In the case of infinite recursion, a GopherJS process will simply stop executing, without generating an error.
A simple reproduction case:
package main
import (
"fmt"
)
func main() {
recurse()
fmt.Printf("This never gets printed\n")
}
func recurse() {
recurse()
}
And when executed, there is no output, where I would expect a stack trace and an error message.
Another simple reproduction case (closer to how I found this bug in real life):
package main
import (
"fmt"
"testing"
)
func TestRecursion (m *testing.T) {
recurse()
fmt.Printf("You won't see this line\n")
}
func recurse() {
recurse()
}
When I execute this one (gopherjs test
), I get the following output:
FAIL github.com/flimzy/jstest 0.299s
This gives me hope that GopherJS is somehow recovering from the error, and retaining control of execution long enough to output the FAIL, and thus that this issue may be resolvable.
When I ran the generated JS code in debugging mode, I was able to see the "Maximum call stack size" with a stack dump when the program crashed.