Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help, cannot start a project with gin + gorm #2972

Closed
JBustin opened this issue Dec 1, 2021 · 4 comments
Closed

Please help, cannot start a project with gin + gorm #2972

JBustin opened this issue Dec 1, 2021 · 4 comments

Comments

@JBustin
Copy link

JBustin commented Dec 1, 2021

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
@jincheng9
Copy link
Contributor

@JBustin Based on the runtime stack, you probably need to update golang.org/x/sys to latest. Refer to this issue: golang/go#46763

@JBustin
Copy link
Author

JBustin commented Dec 2, 2021

Problem resolved thanks to @jincheng9 !

@JBustin JBustin closed this as completed Dec 2, 2021
@jincheng9
Copy link
Contributor

cheers!

@standardloop
Copy link

fixed my error, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants