I am getting the following issue after idle time
(invalid connection)
[2018-12-31 01:35:54]
[mysql] 2018/12/31 01:35:54 packets.go:36: unexpected EOF
(invalid connection)
[2018-12-31 01:35:54]
go version)?go version go1.9 linux/amd64
ENV:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/shakhawat/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build819959234=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
mysql Ver 15.1 Distrib 10.1.35-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
func CheckMobileExist(c *gin.Context) {
mobile := c.Params.ByName("mobile")
type User struct {
Mobile string
}
var user User
//get db connection
var getDB = db.GetDB()
if err := getDB.Where("mobile = ?", mobile).First(&user).Error; err != nil {
fmt.Println(err)
}
c.JSON(200, user)
}
I get exactly the same problem. Any suggestions?
Update the mysql-driver, newest version should have a fix for this. See also https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/.
Most helpful comment
Update the mysql-driver, newest version should have a fix for this. See also https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/.