Thanks to visit codestin.com
Credit goes to github.com

Skip to content

max_conns and max_conn_lifetime breaks db.Ping #464

@matteosuppo

Description

@matteosuppo
$ export DATABASE_URL="postgres://*:*@*:5432/auth?max_conn_lifetime=1m&max_conns=20&max_idle_conns=4"
$ ./hydra host --dangerous-force-http                                                                                                                                   
INFO[0000] Connecting with postgres://*:*@*:5432/auth?max_conn_lifetime=1m&max_conns=20&max_idle_conns=4 
ERRO[0000] An error occurred                             error="Could not connect to SQL: pq: unrecognized configuration parameter "max_idle_conns""

Investigating I discovered that it's this call that fails: https://github.com/ory/hydra/blob/master/config/backend_connections.go#L41

Unfortunately the custom parameters hydra uses to control the number of connections appear to break the connection since they're not recognized by the database library.

Not sure if this happens with all postgres databases. I tried with our production one and a docker one summoned with

docker run --rm --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres -d 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions