Description
I'm experimenting a fatal error with two lines of code, by adding gin + gorm to my project. Gin alone is ok. Gorm alone is ok. Gin + Gorm is ko.
go run main.go
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[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=0x7fff203a0c9e]
...
/Users/justin/go/pkg/mod/golang.org/x/sys@v0.0.0-20210423082822-04245dca01da/unix/ioctl.go:73
github.com/mattn/go-isatty.IsTerminal(0x4771a2b)
/Users/justin/go/pkg/mod/github.com/mattn/go-isatty@v0.0.12/isatty_bsd.go:10 +0x50 fp=0xc00029fe58 sp=0xc00029fde8 pc=0x4484570
github.com/gin-gonic/gin.LoggerWithConfig({0x0, {0x0, 0x0}, {0x0, 0x0, 0x0}})
/Users/justin/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/logger.go:220 +0x174 fp=0xc00029fed8 sp=0xc00029fe58 pc=0x4490794
github.com/gin-gonic/gin.Logger(...)
/Users/justin/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/logger.go:184
github.com/gin-gonic/gin.Default()
/Users/justin/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:198 +0x3d fp=0xc00029ff38 sp=0xc00029fed8 pc=0x448c7dd
main.main()
/Users/justin/go/src/github.com/go-mservice-bench/main.go:11 +0xaa fp=0xc00029ff80 sp=0xc00029ff38 pc=0x45497ca
How to reproduce
main.go
package main
import (
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func main() {
gorm.Open(sqlite.Open(".data/sqlite.db"), &gorm.Config{})
gin.Default()
}
Expectations
Nothing
Actual result
Fatal error
Environment
- go version: go1.17.3 darwin/amd64
- gin version (or commit ref): github.com/gin-gonic/gin v1.7.7
- operating system: macos 11.6
Comment From: jincheng9
@JBustin Based on the runtime stack, you probably need to update golang.org/x/sys to latest. Refer to this issue: https://github.com/golang/go/issues/46763
Comment From: JBustin
Problem resolved thanks to @jincheng9 !
Comment From: jincheng9
cheers!
Comment From: standardloop
fixed my error, thanks.