Limit golang exceed

Hello everyone this is my problem golang apparently said that I exceed the limits.
Would there any way to overcome these limitations?

C:\Users\Dylan\Desktop>go run 1.go
2016/09/28 16:02:28 Listening
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x67eeb6, 0xe)
C:/Go/src/runtime/panic.go:566 +0x9c
runtime.newstack()
C:/Go/src/runtime/stack.go:1061 +0x424
runtime.morestack()
C:/Go/src/runtime/asm_amd64.s:366 +0x87

goroutine 6 [running]:
main.PageRequest(0x68004e0, 0xc04203a270, 0xc0420b21e0)
C:/Users/Dylan/Desktop/1.go:118 fp=0xc082233b78 sp=0xc082233b70
net/http.HandlerFunc.ServeHTTP(0x671fd60, 0x68004e0, 0xc04203a270, 0xc0420b21e0)
C:/Go/src/net/http/server.go:1726 +0x4b fp=0xc082233ba0 sp=0xc082233b78
net/http.(*ServeMux).ServeHTTP(0x681b940, 0x68004e0, 0xc04203a270, 0xc0420b21e0)
C:/Go/src/net/http/server.go:2022 +0x86 fp=0xc082233be0 sp=0xc082233ba0
net/http.serverHandler.ServeHTTP(0xc042068500, 0x68004e0, 0xc04203a270, 0xc0420b21e0)
C:/Go/src/net/http/server.go:2202 +0x84 fp=0xc082233c28 sp=0xc082233be0
net/http.(*conn).serve(0xc042068580, 0x68008a0, 0xc042422600)
C:/Go/src/net/http/server.go:1579 +0x4be fp=0xc082233e88 sp=0xc082233c28
runtime.goexit()
C:/Go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc082233e90 sp=0xc082233e88
created by net/http.(*Server).Serve
C:/Go/src/net/http/server.go:2293 +0x454

goroutine 1 [IO wait]:
net.runtime_pollWait(0x6aaab40, 0x72, 0xc042420ac0)
C:/Go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0xc0423b8170, 0x72, 0xc042420ac0, 0xc042077a98)
C:/Go/src/net/fd_poll_runtime.go:73 +0x3f
net.(*ioSrv).ExecIO(0xc042024000, 0xc0423b8060, 0x67d17c, 0x8, 0xc0420af2a0, 0xc0423b8300, 0x0, 0x0)
C:/Go/src/net/fd_windows.go:171 +0x186
net.(*netFD).acceptOne(0xc0423b8000, 0xc04206e0e0, 0x2, 0x2, 0xc0423b8060, 0xc04201a000, 0x0, 0x0)
C:/Go/src/net/fd_windows.go:529 +0x1f8
net.(*netFD).accept(0xc0423b8000, 0x0, 0x0, 0x0)
C:/Go/src/net/fd_windows.go:559 +0x131
net.(*TCPListener).accept(0xc042024028, 0x29e8d60800, 0x0, 0x0)
C:/Go/src/net/tcpsock_posix.go:132 +0x35
net.(*TCPListener).AcceptTCP(0xc042024028, 0xc042077d88, 0xc042077d90, 0xc042077d80)
C:/Go/src/net/tcpsock.go:209 +0x50
net/http.tcpKeepAliveListener.Accept(0xc042024028, 0x671ff08, 0xc042068580, 0x6800960, 0xc042427b60)
C:/Go/src/net/http/server.go:2608 +0x36
net/http.(*Server).Serve(0xc042068500, 0x6800520, 0xc042024028, 0x0, 0x0)
C:/Go/src/net/http/server.go:2273 +0x1d5
net/http.(*Server).ListenAndServe(0xc042068500, 0xc042068500, 0x0)
C:/Go/src/net/http/server.go:2219 +0xbb
net/http.ListenAndServe(0x67c3e1, 0x3, 0x0, 0x0, 0xc04200b1c0, 0x0)
C:/Go/src/net/http/server.go:2351 +0xa7
main.main()
C:/Users/Dylan/Desktop/1.go:198 +0x11b
exit status 2

Please post the code that is causing the issue.

I’m going to take a wild guess though (only read the the first part of that stack trace) and assume that you are either accidentally creating a huge number of goroutines without them dying off at all or are just leaking goroutines and don’t realize and either way you must be allocating on the stack in each goroutine, which is causing you to exceed the limit.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.