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

Connection overflow pq: SSL is not enabled on the server #840

Closed
leopucci opened this issue Mar 24, 2019 · 1 comment · Fixed by #843
Closed

Connection overflow pq: SSL is not enabled on the server #840

leopucci opened this issue Mar 24, 2019 · 1 comment · Fixed by #843

Comments

@leopucci
Copy link

leopucci commented Mar 24, 2019

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

Untitled


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()
	}
adriansr added a commit to adriansr/pq that referenced this issue Apr 2, 2019
When connecting to a server using SSL fails (i.e. with SSL disabled)
the connection was never freed.

Fixes lib#840
@leopucci
Copy link
Author

leopucci commented Apr 2, 2019

Fixed

@leopucci leopucci closed this as completed Apr 2, 2019
maddyblue pushed a commit that referenced this issue May 7, 2019
When connecting to a server using SSL fails (i.e. with SSL disabled)
the connection was never freed.

Fixes #840
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

Successfully merging a pull request may close this issue.

1 participant