You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the startup, the connection to the database works fine for the first request. However, after the first request, I start to get the following error:
SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable (Connection: pgsql, SQL: (select * from ........)
Environment:
Laravel 9.52.15
PHP 8.2
PostgreSQL 15.6
Findings:
I tracked down the problem and discovered that PDO is not actually opening a connection to PostgreSQL. When using PDO, the error above occurs. However, when using pg_connect, the connection can be established and queries can be executed. Here are my findings:
Cannot open a connection using PDO.
I can open a connection using pg_connect (fly proxy).
I can open a connection from a database manager application.
The issue occurs in both development and production environments.
Attempts to Fix:
I changed sslmode in database.php from prefer to disable. For a short period, the connection was established, and queries could be executed. However, shortly after, I encountered a connection reset by peer error (from PostgreSQL log) and in the application log:
SQLSTATE[08006] [7] could not send startup packet: Resource temporarily unavailable (Connection: pgsql, SQL: (select * from ........)
I rolled back my deployment to December 2023 and checked the installed PHP extension versions. I found that the new deployment was using php8.2-swoole version 5.1.3, while the December 2023 deployment was using version 5.1.1. After comparing the commits between Swoole versions 5.1.1 and 5.1.3, I noticed several changes related to SSL, and I decided not to delve further into the details.
Temporary Solution:
To fix this issue, I forked this repository, removed the php8.2-swoole package, and built my own Docker image. I do not use PHP Swoole in my application.
The text was updated successfully, but these errors were encountered:
Description:
At the startup, the connection to the database works fine for the first request. However, after the first request, I start to get the following error:
Environment:
Findings:
I tracked down the problem and discovered that PDO is not actually opening a connection to PostgreSQL. When using PDO, the error above occurs. However, when using
pg_connect
, the connection can be established and queries can be executed. Here are my findings:pg_connect
(fly proxy).Attempts to Fix:
I changed
sslmode
indatabase.php
fromprefer
todisable
. For a short period, the connection was established, and queries could be executed. However, shortly after, I encountered aconnection reset by peer
error (from PostgreSQL log) and in the application log:I rolled back my deployment to December 2023 and checked the installed PHP extension versions. I found that the new deployment was using
php8.2-swoole
version5.1.3
, while the December 2023 deployment was using version5.1.1
. After comparing the commits between Swoole versions5.1.1
and5.1.3
, I noticed several changes related to SSL, and I decided not to delve further into the details.Temporary Solution:
To fix this issue, I forked this repository, removed the
php8.2-swoole
package, and built my own Docker image. I do not use PHP Swoole in my application.The text was updated successfully, but these errors were encountered: