Skip to content

[13.x] Recognize PgBouncer SSL EOF failover errors as lost connections - #61918

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
0x15f:fix/pgbouncer-ssl-eof
Oct 7, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
0x15f:fix/pgbouncer-ssl-eof

Conversation

@0x15f

@0x15f 0x15f commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PgBouncer can insert a FATAL reason before PostgreSQL's SSL EOF message. Laravel currently recognizes:

SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected

The following messages observed in production do not match that contiguous substring:

SQLSTATE[HY000]: General error: 7 FATAL: server conn crashed?
SSL SYSCALL error: EOF detected
SQLSTATE[HY000]: General error: 7 FATAL: client_idle_timeout
SSL SYSCALL error: EOF detected

This replaces the existing signature with SSL SYSCALL error: EOF detected. The suffix remains specific to PostgreSQL/libpq SSL transport errors; it does not match generic EOF text. These formatting variants can consequently use the existing lost-connection handling, subject to Laravel's existing transaction and retry rules. No retry policy is changed.

Related: #32697, which introduced the existing signature and mentioned the shorter suffix.

Regression tests preserve the original message, cover both PgBouncer variants, and reject an unrelated application EOF exception. Both PgBouncer cases fail before the change and pass afterward.

Validation:

  • vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Database/DatabaseConnectionLostTest.php — 9 tests, 9 assertions passed.
  • vendor/bin/pint --test src/Illuminate/Database/LostConnectionDetector.php tests/Database/DatabaseConnectionLostTest.php — passed.
  • git diff --check — passed.

The separate server_login_retry signature is intentionally left for a follow-up with its own complete exception example.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@0x15f
0x15f marked this pull request as ready for review October 7, 2026 14:23
@taylorotwell
taylorotwell merged commit 38006c1 into laravel:13.x Oct 7, 2026
64 checks passed
binaryfire added a commit to hypervel/components-backup that referenced this pull request Oct 26, 2026
Apply laravel/framework#61918 (38006c1ca5). Match the SSL SYSCALL EOF fragment even when PostgreSQL adds a server-crash or idle-timeout message before it. Preserve the PDO/explicit-driver boundary and query-context unwrapping. Port all three messages and the unrelated-EOF negative case. The database suite, formatting and full analysis pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants