Skip to content

POOL_SIZE, TIMEZONE and CLIENT_ENCODING render a config pgbouncer refuses to load #132

Description

@jclaveau

Setting POOL_SIZE makes the container refuse to start:

$ docker run --rm -e DB_HOST=db.example.com -e POOL_SIZE=30 edoburu/pgbouncer
ERROR unknown parameter: pgbouncer/pool_size
ERROR invalid value "30" for parameter pool_size in configuration (/etc/pgbouncer/pgbouncer.ini:11)
FATAL cannot load config file

Reproduced on v1.25.2-p0, v1.24.1-p1 and v1.23.1-p3, so it is not a recent regression.

Cause

entrypoint.sh writes it into the [pgbouncer] section:

${POOL_SIZE:+pool_size = ${POOL_SIZE}\n}\

but pool_size is a [databases] parameter. The process-wide equivalent is default_pool_size, which the image already exposes correctly as DEFAULT_POOL_SIZE.

Same class, two more

Both are also [databases]-only parameters emitted into [pgbouncer] or on their own line:

  • TIMEZONEERROR unknown parameter: pgbouncer/timezone
  • CLIENT_ENCODING → rendered on a line of its own inside [databases], giving ERROR syntax error in connection string then invalid value "UTF8" for parameter client_encoding

So three of the documented variables cannot be set at all without the container failing to boot.

Possible fix

Emit the three on the database line, where pgbouncer accepts them:

[databases]
appdb = host=db.example.com port=5432 auth_user=postgres client_encoding=UTF8 timezone=UTC pool_size=30

I have this working in a fork along with tests that boot the container per case, which is what surfaced it — a rendered file that is never loaded looks fine until pgbouncer reads it. Happy to open a PR if you would like it.

Assisted-by: Claude:claude-opus-5[1m]

Activity

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

      No branches or pull requests

      Issue actions