Closed
Description
Hello, thanks for the great lib!
We are having some trouble on windows when there is no ssl enabled on postgresql..
If I add the ?sslmode=disable the library works ok,
If I left the lib returning the error message, pq: SSL is not enabled on the server, db.Closes does not work and the connections keep rising. Take a look....
db.SetMaxOpenConns(10) //DOES NOT WORK
db.SetMaxIdleConns(5) //DOES NOT WORK
db, err := sql.Open("postgres", m.HostData().URI)
if err != nil {
logger.Error(err)
reporter.Error(err)
return
}
// Set the maximum number of concurrently open connections to 5. Setting this
// to less than or equal to 0 will mean there is no maximum limit (which
// is also the default setting).
db.SetMaxOpenConns(10) //DOES NOT WORK
db.SetMaxIdleConns(5) //DOES NOT WORK
defer db.Close()
results, err := postgresql.QueryStats(db, "SELECT * FROM pg_stat_bgwriter") //DO A DB.QUERY
if err != nil {
err = errors.Wrap(err, "QueryStats")
logger.Error(err)
reporter.Error(err)
return //WILL EXIT HERE AND CALL db.Close()
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
Fix connection leak on SSL failure
leopucci commentedon Apr 2, 2019
Fixed
Fix connection leak on SSL failure