Closed illyabusigin closed 8 years ago
Attaching stack output, it looks like the issue is within finalizeExample
:
exit status 2
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow
runtime stack:
runtime.throw(0x5ae870, 0xe)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:547 +0x90
runtime.newstack()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/stack.go:940 +0xb11
runtime.morestack()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:359 +0x7f
goroutine 1 [stack growth]:
runtime.heapBitsSetType(0xc8217d46a0, 0x20, 0x20, 0x410e40)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mbitmap.go:679 fp=0xc8402002f0 sp=0xc8402002e8
runtime.mallocgc(0x20, 0x410e40, 0x0, 0x0)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:682 +0x6c0 fp=0xc8402003c8 sp=0xc8402002f0
runtime.newarray(0x410e40, 0x2, 0x0)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:798 +0xc9 fp=0xc840200408 sp=0xc8402003c8
runtime.makeslice(0x3fdf80, 0x0, 0x2, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/slice.go:32 +0x165 fp=0xc840200458 sp=0xc840200408
ingaged/vendor/github.com/goadesign/goa/design.(*AttributeDefinition).finalizeExample(0xc820084b40, 0xc82316a000, 0x6bca0, 0x71800, 0x0, 0x0, 0x0)
/Users/illyabusigin/Documents/code/go/src/ingaged/vendor/github.com/goadesign/goa/design/definitions.go:1009 +0x69e fp=0xc8402006b8 sp=0xc840200458
ingaged/vendor/github.com/goadesign/goa/design.(*AttributeDefinition).finalizeExample(0xc820084900, 0xc82316a000, 0x6bc9f, 0x71800, 0x0, 0x0, 0x0)
/Users/illyabusigin/Documents/code/go/src/ingaged/vendor/github.com/goadesign/goa/design/definitions.go:996 +0x10a fp=0xc840200918 sp=0xc8402006b8
ingaged/vendor/github.com/goadesign/goa/design.(*AttributeDefinition).finalizeExample(0xc820084b40, 0xc82316a000, 0x6bc9f, 0x71800, 0x0, 0x0, 0x0)
/Users/illyabusigin/Documents/code/go/src/ingaged/vendor/github.com/goadesign/goa/design/definitions.go:1041 +0xaec fp=0xc840200b78 sp=0xc840200918
ingaged/vendor/github.com/goadesign/goa/design.(*AttributeDefinition).finalizeExample(0xc820084900, 0xc82316a000, 0x6bc9e, 0x71800, 0x0, 0x0, 0x0)
/Users/illyabusigin/Documents/code/go/src/ingaged/vendor/github.com/goadesign/goa/design/definitions.go:996 +0x10a fp=0xc840200dd8 sp=0xc840200b78
I found a workaround for this issue. If you use NoExample()
, finalize example is never called. Example updated media type:
var Menu = MediaType("application/vnd.menu+json", func() {
Attributes(func() {
Attribute("name", String, "The name of an application")
Attribute("children", CollectionOf("application/vnd.menu"), func() {
NoExample()
})
})
View("default", func() {
Attribute("name")
Attribute("children")
})
})
Thank you for the detailed report! I'll take a look.
The PR above should fix it, can you confirm? Thanks!
Confirmed, thank you!
When trying to recursively reference a media type using the media type identifier goagen gets stuck in an infinite loop.
I'll try and dig into this a bit more today and tomorrow to see if I can find the root cause.