Golang stack overflow

1,540 views
Skip to first unread message

Laurent Hausermann

unread,
Jun 4, 2014, 10:46:15 AM6/4/14
to golan...@googlegroups.com
Hi Folks,

Not sure this is really a bug, or a compiler lacks, but when referencing a pointer and not the value in a fmt.Sprintf("blabla %x", pointer) call, Go runtime goes into stack overflow... and received a weird "kill signal" without extra debug information.

I've spent several hours chasing this behaviour, because of a unknown value of a const. So I've reproduced it using a dummy example.

Thanks for your comments

Laurent

James Bardin

unread,
Jun 4, 2014, 10:50:28 AM6/4/14
to golan...@googlegroups.com

Sprintf is calling String(), so you're recursing indefinitely.

Don't do that :)

Jan Mercl

unread,
Jun 4, 2014, 10:53:19 AM6/4/14
to Laurent Hausermann, golang-nuts
On Wed, Jun 4, 2014 at 4:46 PM, Laurent Hausermann
<laurent.h...@gmail.com> wrote:
> Please find it here : http://play.golang.org/p/61XhC3wBE_

What James said. And a fix: http://play.golang.org/p/52py0W4nJU

-j

Laurent Hausermann

unread,
Jun 4, 2014, 10:55:34 AM6/4/14
to Jan Mercl, golang-nuts
OK, got it.
This is really silly, but I spent hours chasing it.. 

Jan Mercl

unread,
Jun 4, 2014, 11:08:06 AM6/4/14
to Laurent Hausermann, golang-nuts
On Wed, Jun 4, 2014 at 4:55 PM, Laurent Hausermann
<laurent.h...@gmail.com> wrote:
> spent hours chasing it..

Is there a stack trace on the crash? If not, one strategically placed
debug print would have probably saved you some time. (inside the
.String() method).

-j

Laurent Hausermann

unread,
Jun 4, 2014, 11:11:49 AM6/4/14
to Jan Mercl, golang-nuts
Well, I am using golang 1.2
And when you run the demo program using 1.2 (I am not sure which golang version is running play.golang.org), you do not have a stack trace...

You wait a couple of seconds and you have only a "Killed" message.

--
Laurent

James Bardin

unread,
Jun 4, 2014, 11:14:04 AM6/4/14
to golan...@googlegroups.com, 0xj...@gmail.com
Always check locally if you can.
The playground has certain restrictions and limitations.

Jan Mercl

unread,
Jun 4, 2014, 11:18:38 AM6/4/14
to Laurent Hausermann, golang-nuts
Running your http://play.golang.org/p/61XhC3wBE_ in the playground gives:

----
runtime: goroutine stack exceeds 250000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x1b4980, 0x5be60)
/tmp/sandbox/go/src/pkg/runtime/panic.c:471 +0xa0
runtime.newstack()
/tmp/sandbox/go/src/pkg/runtime/stack.c:295 +0x440
runtime.morestack()
/tmp/sandbox/go/src/pkg/runtime/asm_amd64p32.s:207 +0x80

goroutine 1 [stack split]:
runtime.markallocated(0x149fcbd0, 0x90, 0x0, 0x0)
/tmp/sandbox/go/src/pkg/runtime/mgc0.c:2331 fp=0xefda20e0
runtime.mallocgc(0x90, 0xf47a0, 0x0, 0xffffffff)
/tmp/sandbox/go/src/pkg/runtime/malloc.goc:101 +0x200 fp=0xefda2128
runtime.new(0xf47a0, 0x0, 0x0, 0x0)
/tmp/sandbox/go/src/pkg/runtime/malloc.goc:705 +0x40 fp=0xefda2140
fmt.func·001(0x1052f280, 0x0)
/tmp/sandbox/go/src/pkg/fmt/print.go:161 +0x40 fp=0xefda2158
fmt.(*cache).get(0x1052f280, 0x0, 0x0, 0x0)
/tmp/sandbox/go/src/pkg/fmt/print.go:149 +0x80 fp=0xefda2180
fmt.newPrinter(0x1bb9b8, 0x0)
/tmp/sandbox/go/src/pkg/fmt/print.go:165 +0x40 fp=0xefda21a8
fmt.Sprintf(0x100238, 0xa, 0xefda21fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:234 +0x40 fp=0xefda21d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2218
fmt.(*pp).handleMethods(0x149fcb40, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda2268
fmt.(*pp).printArg(0x149fcb40, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda22a8
fmt.(*pp).doPrintf(0x149fcb40, 0x100238, 0xa, 0xefda247c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda2428
fmt.Sprintf(0x100238, 0xa, 0xefda247c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda2458
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2498
fmt.(*pp).handleMethods(0x149fcab0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda24e8
fmt.(*pp).printArg(0x149fcab0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda2528
fmt.(*pp).doPrintf(0x149fcab0, 0x100238, 0xa, 0xefda26fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda26a8
fmt.Sprintf(0x100238, 0xa, 0xefda26fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda26d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2718
fmt.(*pp).handleMethods(0x149fca20, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda2768
fmt.(*pp).printArg(0x149fca20, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda27a8
fmt.(*pp).doPrintf(0x149fca20, 0x100238, 0xa, 0xefda297c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda2928
fmt.Sprintf(0x100238, 0xa, 0xefda297c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda2958
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2998
fmt.(*pp).handleMethods(0x149fc990, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda29e8
fmt.(*pp).printArg(0x149fc990, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda2a28
fmt.(*pp).doPrintf(0x149fc990, 0x100238, 0xa, 0xefda2bfc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda2ba8
fmt.Sprintf(0x100238, 0xa, 0xefda2bfc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda2bd8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2c18
fmt.(*pp).handleMethods(0x149fc900, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda2c68
fmt.(*pp).printArg(0x149fc900, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda2ca8
fmt.(*pp).doPrintf(0x149fc900, 0x100238, 0xa, 0xefda2e7c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda2e28
fmt.Sprintf(0x100238, 0xa, 0xefda2e7c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda2e58
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda2e98
fmt.(*pp).handleMethods(0x149fc870, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda2ee8
fmt.(*pp).printArg(0x149fc870, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda2f28
fmt.(*pp).doPrintf(0x149fc870, 0x100238, 0xa, 0xefda30fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda30a8
fmt.Sprintf(0x100238, 0xa, 0xefda30fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda30d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3118
fmt.(*pp).handleMethods(0x149fc7e0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda3168
fmt.(*pp).printArg(0x149fc7e0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda31a8
fmt.(*pp).doPrintf(0x149fc7e0, 0x100238, 0xa, 0xefda337c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda3328
fmt.Sprintf(0x100238, 0xa, 0xefda337c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda3358
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3398
fmt.(*pp).handleMethods(0x149fc750, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda33e8
fmt.(*pp).printArg(0x149fc750, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda3428
fmt.(*pp).doPrintf(0x149fc750, 0x100238, 0xa, 0xefda35fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda35a8
fmt.Sprintf(0x100238, 0xa, 0xefda35fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda35d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3618
fmt.(*pp).handleMethods(0x149fc6c0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda3668
fmt.(*pp).printArg(0x149fc6c0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda36a8
fmt.(*pp).doPrintf(0x149fc6c0, 0x100238, 0xa, 0xefda387c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda3828
fmt.Sprintf(0x100238, 0xa, 0xefda387c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda3858
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3898
fmt.(*pp).handleMethods(0x149fc630, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda38e8
fmt.(*pp).printArg(0x149fc630, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda3928
fmt.(*pp).doPrintf(0x149fc630, 0x100238, 0xa, 0xefda3afc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda3aa8
fmt.Sprintf(0x100238, 0xa, 0xefda3afc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda3ad8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3b18
fmt.(*pp).handleMethods(0x149fc5a0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda3b68
fmt.(*pp).printArg(0x149fc5a0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda3ba8
fmt.(*pp).doPrintf(0x149fc5a0, 0x100238, 0xa, 0xefda3d7c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda3d28
fmt.Sprintf(0x100238, 0xa, 0xefda3d7c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda3d58
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda3d98
fmt.(*pp).handleMethods(0x149fc510, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda3de8
fmt.(*pp).printArg(0x149fc510, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda3e28
fmt.(*pp).doPrintf(0x149fc510, 0x100238, 0xa, 0xefda41fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda3fa8
----- stack segment boundary -----
fmt.Sprintf(0x100238, 0xa, 0xefda41fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda41d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4218
fmt.(*pp).handleMethods(0x149fc480, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda4268
fmt.(*pp).printArg(0x149fc480, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda42a8
fmt.(*pp).doPrintf(0x149fc480, 0x100238, 0xa, 0xefda447c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda4428
fmt.Sprintf(0x100238, 0xa, 0xefda447c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda4458
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4498
fmt.(*pp).handleMethods(0x149fc3f0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda44e8
fmt.(*pp).printArg(0x149fc3f0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda4528
fmt.(*pp).doPrintf(0x149fc3f0, 0x100238, 0xa, 0xefda46fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda46a8
fmt.Sprintf(0x100238, 0xa, 0xefda46fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda46d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4718
fmt.(*pp).handleMethods(0x149fc360, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda4768
fmt.(*pp).printArg(0x149fc360, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda47a8
fmt.(*pp).doPrintf(0x149fc360, 0x100238, 0xa, 0xefda497c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda4928
fmt.Sprintf(0x100238, 0xa, 0xefda497c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda4958
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4998
fmt.(*pp).handleMethods(0x149fc2d0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda49e8
fmt.(*pp).printArg(0x149fc2d0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda4a28
fmt.(*pp).doPrintf(0x149fc2d0, 0x100238, 0xa, 0xefda4bfc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda4ba8
fmt.Sprintf(0x100238, 0xa, 0xefda4bfc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda4bd8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4c18
fmt.(*pp).handleMethods(0x149fc240, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda4c68
fmt.(*pp).printArg(0x149fc240, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda4ca8
fmt.(*pp).doPrintf(0x149fc240, 0x100238, 0xa, 0xefda4e7c, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda4e28
fmt.Sprintf(0x100238, 0xa, 0xefda4e7c, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda4e58
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda4e98
fmt.(*pp).handleMethods(0x149fc1b0, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda4ee8
fmt.(*pp).printArg(0x149fc1b0, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda4f28
fmt.(*pp).doPrintf(0x149fc1b0, 0x100238, 0xa, 0xefda50fc, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:1182 +0x1dc0 fp=0xefda50a8
fmt.Sprintf(0x100238, 0xa, 0xefda50fc, 0x1, 0x1, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:235 +0x80 fp=0xefda50d8
main.(*MyType).String(0x10500168, 0xec360, 0x10500168, 0x78)
/tmpfs/gosandbox-bace1322_bfe36646_1de5b35c_888fb26a_db85992b/prog.go:21
+0x140 fp=0xefda5118
fmt.(*pp).handleMethods(0x149fc120, 0x78, 0x8dc90000, 0x0, 0xd0100, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:722 +0x660 fp=0xefda5168
fmt.(*pp).printArg(0x149fc120, 0xec360, 0x10500168, 0x78, 0x0, ...)
/tmp/sandbox/go/src/pkg/fmt/print.go:813 +0x4c0 fp=0xefda51a8

goroutine 2 [syscall]:
runtime.notetsleepg(0xfeefdf88, 0x0, 0xf8475800, 0xd)
/tmp/sandbox/go/src/pkg/runtime/lock_sema.c:254 +0xa0
runtime.MHeap_Scavenger()
/tmp/sandbox/go/src/pkg/runtime/mheap.c:463 +0xc0
runtime.goexit()
/tmp/sandbox/go/src/pkg/runtime/proc.c:1394
created by runtime.main
/tmp/sandbox/go/src/pkg/runtime/proc.c:179
[process exited with non-zero status]

----

From the above the cyclic/recursive execution path can be seen and the
culprit (line 21) even gets red flagged ;-)

-j

Laurent Hausermann

unread,
Jun 4, 2014, 11:24:33 AM6/4/14
to Jan Mercl, golang-nuts
Yes, but locally using golang 1.2 you do not have this stack

Dave Cheney

unread,
Jun 4, 2014, 4:57:55 PM6/4/14
to golan...@googlegroups.com, 0xj...@gmail.com
You're probably running linux and the OOM killer will have stomped on your process before it ran out of memory.


I write this back in the 1.1 timeframe, at that point the stack was effectively infinite on amd64, since that time it has been limited to an impossibly huge number, but is not infinite.

You can see the action of the OOM killer in dmesg.

Cheers

Dave

Laurent Hausermann

unread,
Jun 5, 2014, 2:52:28 AM6/5/14
to Dave Cheney, golang-nuts, Jan Mercl
Thanks Dave.

You are right, I did not notice that the OOM killer was raised...

Laurent
PS : my coding environement, is hosted in a vm, so I did not notice anything on my laptop


--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/7VmCd7w81VU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick Craig-Wood

unread,
Jun 5, 2014, 6:31:00 AM6/5/14
to Jan Mercl, Laurent Hausermann, golang-nuts
I'd say use %p - that is what it is for

http://play.golang.org/p/Y3gWnoyjv5


--
Nick Craig-Wood <ni...@craig-wood.com> -- http://www.craig-wood.com/nick
Reply all
Reply to author
Forward
0 new messages