Hi Team,
I am creating connection pool in golang with below configuration…
db.SetMaxOpenConns(1000)
db.SetMaxIdleConns(100)
db.SetConnMaxIdleTime(time.Minute * time.Duration(3))
db.SetConnMaxLifetime(time.Hour * time.Duration(1))
In the meanwhile, I am creating 10000 go routines they will do database updates… I am getting
[mysql] 2022/02/18 17:54:34 packets.go:37: unexpected EOF and
[mysql] 2022/02/18 17:26:35 packets.go:37: read tcp : read: connection timed out
Frequently and missing updates… What the code does is below
result, err := db.Exec(query, params)
Kindly advice, what configuration I am missing or I have to implement lock and unlock for getting connection ?
luk4z7
(Lucas Alves)
February 19, 2022, 3:38am
2
check if your connection keep alive for long time, and try to see this links
opened 10:49PM - 26 Sep 17 UTC
closed 10:30AM - 27 Sep 17 UTC
### Issue description
Getting Invalid Connection issues.
### Error log
```
…
[mysql] 2017/09/26 22:38:16 packets.go:36: unexpected EOF
[HTTP Server] http: panic serving xxx.xxx.xxx.xxx:39727: runtime error: invalid memory address or nil pointer dereference
goroutine 25 [running]:
net/http.(*conn).serve.func1(0x1a83a2a0)
/usr/local/go/src/net/http/server.go:1697 +0x9f
panic(0x84ed320, 0x8849160)
/usr/local/go/src/runtime/panic.go:491 +0x1d0
database/sql.(*Stmt).Close(0x0, 0x0, 0x0)
/usr/local/go/src/database/sql/sql.go:2335 +0x2d
main.postLogin.func1(0x88225e0, 0x1a840a00)
/root/go/src/app/main.go:977 +0x1b8
github.com/kataras/iris/context.Next(0x88225e0, 0x1a840a00)
/root/go/src/github.com/kataras/iris/context/context.go:851 +0xce
github.com/kataras/iris/context.(*context).Next(0x1a840a00)
/root/go/src/github.com/kataras/iris/context/context.go:1063 +0x2b
main.main.func2(0x88225e0, 0x1a840a00)
/root/go/src/app/main.go:57 +0x24f
github.com/kataras/iris/context.Do(0x88225e0, 0x1a840a00, 0x1a827d18, 0x2, 0x2)
/root/go/src/github.com/kataras/iris/context/context.go:864 +0x61
github.com/kataras/iris/context.(*context).Do(0x1a840a00, 0x1a827d18, 0x2, 0x2)
/root/go/src/github.com/kataras/iris/context/context.go:1006 +0x43
github.com/kataras/iris/core/router.(*routerHandler).HandleRequest(0x1a8317f0, 0x88225e0, 0x1a840a00)
/root/go/src/github.com/kataras/iris/core/router/handler.go:216 +0x3f1
github.com/kataras/iris/core/router.(*Router).BuildRouter.func1(0x88198a0, 0x1a578090, 0x1a89a580)
/root/go/src/github.com/kataras/iris/core/router/router.go:70 +0x6d
github.com/kataras/iris/core/router.(*Router).ServeHTTP(0x1a75bb60, 0x88198a0, 0x1a578090, 0x1a89a580)
/root/go/src/github.com/kataras/iris/core/router/router.go:147 +0x37
net/http.serverHandler.ServeHTTP(0x1a59f980, 0x88198a0, 0x1a578090, 0x1a89a580)
/usr/local/go/src/net/http/server.go:2619 +0x8e
net/http.(*conn).serve(0x1a83a2a0, 0x881a0a0, 0x1a8898c0)
/usr/local/go/src/net/http/server.go:1801 +0x5d1
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2720 +0x1f6
[mysql] 2017/09/26 22:38:16 connection.go:158: invalid connection
```
*Go version:* run `go version` in your console
=> go1.9 linux/386
*Server version:* E.g. MySQL 5.6, MariaDB 10.0.20
=> 5.5.56-MariaDB
*Server OS:* E.g. Debian 8.1 (Jessie), Windows 10
=> Centos
system
(system)
Closed
May 20, 2022, 3:38am
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.