gothinkster / golang-gin-realworld-example-app

Exemplary real world application built with Golang + Gin
https://realworld.io
MIT License
2.5k stars 495 forks source link

fatal error: unexpected signal during runtime execution #29

Open dchebakov opened 2 years ago

dchebakov commented 2 years ago

Hi,

Thank you for the project! I'm having some problems to start the application. I'm using golang go1.17.2 darwin/amd64 and right after go run hello.go I'm getting the following error:

$ go run hello.go 
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff2046bc9e]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2046bc9e
stack: frame={sp:0x7ffeefbff258, fp:0x7ffeefbff2a8} stack=[0x7ffeefb802f8,0x7ffeefbff360)
0x00007ffeefbff158:  0x01007ffeefbff178  0x0000000000000004 
0x00007ffeefbff168:  0x000000000000001f  0x00007fff2046bc9e 
0x00007ffeefbff178:  0x0b01dfacedebac1e  0x0000000000000001 
0x00007ffeefbff188:  0x0000000004036711 <runtime.throw+0x0000000000000071>  0x00007ffeefbff228 
0x00007ffeefbff198:  0x000000000477b752  0x00007ffeefbff1e0 
0x00007ffeefbff1a8:  0x00000000040369c8 <runtime.fatalthrow.func1+0x0000000000000048>  0x0000000004c869c0 
0x00007ffeefbff1b8:  0x0000000000000001  0x0000000000000001 
0x00007ffeefbff1c8:  0x00007ffeefbff228  0x0000000004036711 <runtime.throw+0x0000000000000071> 
0x00007ffeefbff1d8:  0x0000000004c869c0  0x00007ffeefbff218 
0x00007ffeefbff1e8:  0x0000000004036950 <runtime.fatalthrow+0x0000000000000050>  0x00007ffeefbff1f8 
0x00007ffeefbff1f8:  0x0000000004036980 <runtime.fatalthrow.func1+0x0000000000000000>  0x0000000004c869c0 
0x00007ffeefbff208:  0x0000000004036711 <runtime.throw+0x0000000000000071>  0x00007ffeefbff228 
0x00007ffeefbff218:  0x00007ffeefbff248  0x0000000004036711 <runtime.throw+0x0000000000000071> 
0x00007ffeefbff228:  0x00007ffeefbff230  0x0000000004036740 <runtime.throw.func1+0x0000000000000000> 
0x00007ffeefbff238:  0x0000000004782dea  0x000000000000002a 
0x00007ffeefbff248:  0x00007ffeefbff298  0x000000000404bd16 <runtime.sigpanic+0x0000000000000396> 
0x00007ffeefbff258: <0x0000000004782dea  0x0000000000000000 
0x00007ffeefbff268:  0x00007ffeefbff2d8  0x0000000004029626 <runtime.(*mheap).allocSpan+0x0000000000000546> 
0x00007ffeefbff278:  0x000000c0003f0000  0x0000000000002000 
0x00007ffeefbff288:  0x000000c000000008  0x00000000040ac700 <syscall.libc_write_trampoline+0x0000000000000000> 
0x00007ffeefbff298:  0x00007ffeefbff2e0 !0x00007fff2046bc9e 
0x00007ffeefbff2a8: >0x00007ffeefbff2e0  0x0000000004c1c000 
0x00007ffeefbff2b8:  0x00000000000004f3  0x00000000044ad065 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005> 
0x00007ffeefbff2c8:  0x00000000040686df <runtime.syscall+0x000000000000001f>  0x000000c0001b3ca0 
0x00007ffeefbff2d8:  0x00007ffeefbff320  0x000000c0001b3c70 
0x00007ffeefbff2e8:  0x0000000004066550 <runtime.asmcgocall+0x0000000000000070>  0x0000000000000001 
0x00007ffeefbff2f8:  0x000000c0003e2000  0x20000000055a2918 
0x00007ffeefbff308:  0x00007ffeefbff320  0x000000000401bdc5 <runtime.SetFinalizer.func1+0x0000000000000025> 
0x00007ffeefbff318:  0x00000000000003b8  0x000000c0000001a0 
0x00007ffeefbff328:  0x0000000004064669 <runtime.systemstack+0x0000000000000049>  0x0000000000000004 
0x00007ffeefbff338:  0x0000000004852378  0x0000000004c869c0 
0x00007ffeefbff348:  0x00007ffeefbff390  0x0000000004064565 <runtime.mstart+0x0000000000000005> 
0x00007ffeefbff358:  0x000000000406451d <runtime.rt0_go+0x000000000000013d> 
runtime.throw({0x4782dea, 0x0})
        /usr/local/go/src/runtime/panic.go:1198 +0x71
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2046bc9e
stack: frame={sp:0x7ffeefbff258, fp:0x7ffeefbff2a8} stack=[0x7ffeefb802f8,0x7ffeefbff360)
0x00007ffeefbff158:  0x01007ffeefbff178  0x0000000000000004 
0x00007ffeefbff168:  0x000000000000001f  0x00007fff2046bc9e 
0x00007ffeefbff178:  0x0b01dfacedebac1e  0x0000000000000001 
0x00007ffeefbff188:  0x0000000004036711 <runtime.throw+0x0000000000000071>  0x00007ffeefbff228 
0x00007ffeefbff198:  0x000000000477b752  0x00007ffeefbff1e0 
0x00007ffeefbff1a8:  0x00000000040369c8 <runtime.fatalthrow.func1+0x0000000000000048>  0x0000000004c869c0 
0x00007ffeefbff1b8:  0x0000000000000001  0x0000000000000001 
0x00007ffeefbff1c8:  0x00007ffeefbff228  0x0000000004036711 <runtime.throw+0x0000000000000071> 
0x00007ffeefbff1d8:  0x0000000004c869c0  0x00007ffeefbff218 
0x00007ffeefbff1e8:  0x0000000004036950 <runtime.fatalthrow+0x0000000000000050>  0x00007ffeefbff1f8 
0x00007ffeefbff1f8:  0x0000000004036980 <runtime.fatalthrow.func1+0x0000000000000000>  0x0000000004c869c0 
0x00007ffeefbff208:  0x0000000004036711 <runtime.throw+0x0000000000000071>  0x00007ffeefbff228 
0x00007ffeefbff218:  0x00007ffeefbff248  0x0000000004036711 <runtime.throw+0x0000000000000071> 
0x00007ffeefbff228:  0x00007ffeefbff230  0x0000000004036740 <runtime.throw.func1+0x0000000000000000> 
0x00007ffeefbff238:  0x0000000004782dea  0x000000000000002a 
0x00007ffeefbff248:  0x00007ffeefbff298  0x000000000404bd16 <runtime.sigpanic+0x0000000000000396> 
0x00007ffeefbff258: <0x0000000004782dea  0x0000000000000000 
0x00007ffeefbff268:  0x00007ffeefbff2d8  0x0000000004029626 <runtime.(*mheap).allocSpan+0x0000000000000546> 
0x00007ffeefbff278:  0x000000c0003f0000  0x0000000000002000 
0x00007ffeefbff288:  0x000000c000000008  0x00000000040ac700 <syscall.libc_write_trampoline+0x0000000000000000> 
0x00007ffeefbff298:  0x00007ffeefbff2e0 !0x00007fff2046bc9e 
0x00007ffeefbff2a8: >0x00007ffeefbff2e0  0x0000000004c1c000 
0x00007ffeefbff2b8:  0x00000000000004f3  0x00000000044ad065 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005> 
0x00007ffeefbff2c8:  0x00000000040686df <runtime.syscall+0x000000000000001f>  0x000000c0001b3ca0 
0x00007ffeefbff2d8:  0x00007ffeefbff320  0x000000c0001b3c70 
0x00007ffeefbff2e8:  0x0000000004066550 <runtime.asmcgocall+0x0000000000000070>  0x0000000000000001 
0x00007ffeefbff2f8:  0x000000c0003e2000  0x20000000055a2918 
0x00007ffeefbff308:  0x00007ffeefbff320  0x000000000401bdc5 <runtime.SetFinalizer.func1+0x0000000000000025> 
0x00007ffeefbff318:  0x00000000000003b8  0x000000c0000001a0 
0x00007ffeefbff328:  0x0000000004064669 <runtime.systemstack+0x0000000000000049>  0x0000000000000004 
0x00007ffeefbff338:  0x0000000004852378  0x0000000004c869c0 
0x00007ffeefbff348:  0x00007ffeefbff390  0x0000000004064565 <runtime.mstart+0x0000000000000005> 
0x00007ffeefbff358:  0x000000000406451d <runtime.rt0_go+0x000000000000013d> 
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:719 +0x396

goroutine 1 [syscall]:
syscall.syscall(0x44ad060, 0x1, 0x40487413, 0xc0001b3d30)
        /usr/local/go/src/runtime/sys_darwin.go:22 +0x3b fp=0xc0001b3ca0 sp=0xc0001b3c80 pc=0x406319b
syscall.syscall(0x40a74c6, 0x30, 0xc0001b3d58, 0x40a73f8)
        <autogenerated>:1 +0x26 fp=0xc0001b3ce8 sp=0xc0001b3ca0 pc=0x4068ea6
golang.org/x/sys/unix.ioctl(0x4769117, 0x4, 0x1000000000010)
        /Users/d.a.chebakov/go/pkg/mod/golang.org/x/sys@v0.0.0-20201119102817-f84b799fce68/unix/zsyscall_darwin_amd64.go:731 +0x39 fp=0xc0001b3d18 sp=0xc0001b3ce8 pc=0x44accf9
golang.org/x/sys/unix.IoctlGetTermios(...)
        /Users/d.a.chebakov/go/pkg/mod/golang.org/x/sys@v0.0.0-20201119102817-f84b799fce68/unix/ioctl.go:72
github.com/mattn/go-isatty.IsTerminal(0x4769117)
        /Users/d.a.chebakov/go/pkg/mod/github.com/mattn/go-isatty@v0.0.12/isatty_bsd.go:10 +0x50 fp=0xc0001b3d88 sp=0xc0001b3d18 pc=0x44ad110
github.com/gin-gonic/gin.LoggerWithWriter({0x485c000, 0xc000010018}, {0x0, 0x0, 0x1})
        /Users/d.a.chebakov/go/pkg/mod/github.com/gin-gonic/gin@v1.1.5-0.20170716034208-93b3a0d7ec95/logger.go:61 +0xca fp=0xc0001b3df0 sp=0xc0001b3d88 pc=0x44b5c8a
github.com/gin-gonic/gin.Logger(...)
        /Users/d.a.chebakov/go/pkg/mod/github.com/gin-gonic/gin@v1.1.5-0.20170716034208-93b3a0d7ec95/logger.go:52
github.com/gin-gonic/gin.Default()
        /Users/d.a.chebakov/go/pkg/mod/github.com/gin-gonic/gin@v1.1.5-0.20170716034208-93b3a0d7ec95/gin.go:137 +0x3f fp=0xc0001b3e48 sp=0xc0001b3df0 pc=0x44b2b1f
main.main()
        /Users/d.a.chebakov/Development/golang-gin-realworld-example-app/hello.go:29 +0x94 fp=0xc0001b3f80 sp=0xc0001b3e48 pc=0x45445b4
runtime.main()
        /usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc0001b3fe0 sp=0xc0001b3f80 pc=0x4038da7
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0001b3fe8 sp=0xc0001b3fe0 pc=0x4066841

goroutine 18 [select]:
database/sql.(*DB).connectionOpener(0xc0002965b0, {0x486a1d8, 0xc0003a8a80})
        /usr/local/go/src/database/sql/sql.go:1196 +0x93
created by database/sql.OpenDB
        /usr/local/go/src/database/sql/sql.go:794 +0x188
exit status 2
lwolle commented 2 years ago

Hey @dchebakov, I observed the same behavior, but as I'm a golang newbie myself, I can only tell how I made it work, without explaining the reason. Update go-gin to the latest, v1.7.4, as the time of writing these lines, and you should be good to go.