The DSN connect_timeout caps the TCP connect, but some libpq builds don't
interrupt a stalled userspace SSL negotiation, so the drain worker can
still hang forever with no error and only stale metrics as a symptom. Arm
pcntl_alarm at 3x the DSN timeout around the PDO construction; if it
fires, the child exits(1) and the parent's SIGCHLD handler restarts it
after the cooldown. Alarm + handler are reset in a finally so a successful
connect leaves no lingering timer.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>