Hello Everybody,
We’re chasing a reminiscence allocation/leak drawback at our manufacturing setup. Added PProf and located {that a} sql goroutine is awak because the construct began.
Curious to know if that is vital when goroutine takes greater than 1500-1800 minutes ?
Right here is the code snippet
Listing Construction
MAIN file.GO
Db.GO
Pprof : pprof exhibits a goroutine connection opener whose time retains growing .
goroutine 19 [select, 1482 minutes]:
database/sql.(*DB).connectionOpener(0xc00049d110, {0xf83e10, 0xc000181a40}) /usr/native/go/src/database/sql/sql.go:1218 +0x8d
created by database/sql.OpenDB /usr/native/go/src/database/sql/sql.go:791 +0x18d
goroutine 26 [select, 1482 minutes]: database/sql.(*DB).connectionOpener(0xc00049c1a0, {0xf83e10, 0xc00011c0f0}) /usr/native/go/src/database/sql/sql.go:1218 +0x8d
created by database/sql.OpenDB /usr/native/go/src/database/sql/sql.go:791 +0x18d
is it regular to have this open for such a very long time ?
from https://kumakichi.github.io/goroutine-leak.html seen that we have to shut
the connection.however closing the connection
utilizing the reference of db is right ? I imply suspecting the general construction.
Kindly assist
Are you setting a max variety of open connections?
Your DB connection shouldn’t be in a goroutine.
if you happen to want a DB connection it is best to set it at your software beginning stage, I imply put it into your important()