Skip to content

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

Closed
@leopucci

Description

@leopucci

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()
	}

Activity

added a commit that references this issue on Apr 2, 2019
3055da2
leopucci

leopucci commented on Apr 2, 2019

@leopucci
Author

Fixed

added a commit that references this issue on May 7, 2019
2ff3cb3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @leopucci

      Issue actions

        Connection overflow pq: SSL is not enabled on the server · Issue #840 · lib/pq