Skip to content

clientauth: nonexistent pgtle.clientauth_db_name causes indefinite login hang #316

Description

@zjyzh

Description

If pgtle.clientauth_db_name names a database that does not exist, every login hangs forever. The clientauth background workers FATAL on startup, the postmaster respawns them once per second, and clientauth_hook waits on a shared-memory rendezvous no live worker ever completes. The GUC is PGC_POSTMASTER, so no one can log in to fix it.

Steps to reproduce

  1. Fresh cluster with pg_tle in shared_preload_libraries.
  2. Set pgtle.enable_clientauth = 'on' and pgtle.clientauth_db_name = 'ghost_db_does_not_exist'.
  3. Restart, then run psql -c 'SELECT 1'.

Expected outcome

Connection succeeds (matching the existing "pg_tle not installed" fallback under on), or is cleanly rejected under require.

Actual outcome

psql hangs indefinitely. Killed by timeout 10 with exit 124 and no output.

Analysis

Have each worker bump a workers_ready counter after BackgroundWorkerInitializeConnection() succeeds. clientauth_hook waits briefly on it before enqueuing, and on timeout falls back to can_allow_without_executing / can_reject_without_executing.

Logs

FATAL:  database "ghost_db_does_not_exist" does not exist
LOG:  background worker "pg_tle_clientauth worker" (PID ...) exited with exit code 1
[repeats every second, forever]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions