-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alpine + Swoole + PgSQL on the host = could not send SSL negotiation packet: Resource temporarily unavailable
#5313
Comments
could not send SSL negotiation packet: Resource temporarily unavailable
It seems that I need to synchronize the code for php8.3 pdo_pgsql. |
Swoole unfortunately doesn't work with PHP 8.3 on Alpine because the most recent published version is the one with the bug 5.1.1. Alpine maintains only the most recent version and it's related to the PECL problem. Ref #5242 |
I encountered the same problem on Debian, and the issue persists after attempting to upgrade PHP to 8.3. $ uname -a
Linux 2a9a37e4e7c4 6.7.11-orbstack-00143-ge6b82e26cd22 #1 SMP Sat Mar 30 12:20:36 UTC 2024 aarch64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
$ php -v
PHP 8.3.6 (cli) (built: Apr 24 2024 19:23:57) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
$ php --ri swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.1.2
Built => May 14 2024 03:45:52
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.0.11 19 Sep 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.18.1
zlib => 1.2.13
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
coroutine_pgsql => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608 |
Same here on alpine with the new version. The thing that sucks is that alpine only has the latest versions which now makes everyone stuck with the broken one. I tried switching to FrankenPHP but Swoole outperforms it by 30x in my humble benchmarks. So it's also hard to say no. |
@myxingkong Can you provide a script for reproduction? |
@flexchar Do you have coroutines enabled? |
@NathanFreeman If this is the fair way to judge, then it seems so. (Note this is the output from the working version) laravel@:/var/www $ php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.0.3
Built => May 11 2023 21:36:59
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.1.0 14 Mar 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
c-ares => 1.19.1
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
mysqlnd => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608 I tried setting them off using the following but the issue remains the same. [swoole]
swoole.enable_coroutine = 0 |
If coroutines are not used, connecting to external servers will not work properly. However, there is no problem connecting to the internal Docker server. $dsn = 'pgsql:dbname=postgres host=192.168.199.201 port=5432';
try {
$db = new PDO($dsn, 'postgres', '123456');
echo "Connected successfully";
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
} Output:
Moving the above code into a coroutine, it can work normally. use function Swoole\Coroutine\run;
run(function () {
$dsn = 'pgsql:dbname=postgres host=192.168.199.201 port=5432';
try {
$db = new PDO($dsn, 'postgres', '123456');
echo "Connected successfully";
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
}); Output:
After attempting to disable coroutines, the problem still exists. Only when I completely disable the Swoole extension, can the problem be solved. |
Hi, |
I have tried many methods,
None of which can be reproduced. |
Or execute |
@NathanFreeman, Did you try the 2nd using the docker image I provided? I used Postrgres.App on mac as the database on the host and in this scenario it will cause the error. |
@NathanFreeman , |
If I run Swoole v5.1.2 and PostgreSQL v15.2 on the same network via docker compose, then everything works fine. But if I assign swoole the network "net1", and postgresql the network "net2", then I get an error "could not send SSL negotiation packet". |
Since the issue is so mysterious, I was able to and made a reproducible. Please try it yourself.
https://github.com/flexchar/pdo-pgsql-issue
Please answer these questions before submitting your issue.
I attempt to connect to the pgsql running on my host mac machine from inside docker container running Laravel. It would fail with
SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable
error.It does work if I would connect using
psql
cli terminal. It also works if I usedpg_connect
insteadphp-pdo
.I cannot test with php83 since the latest swoole pecl upstream has been broken for months now. I am not sure what's going on.
What did you expect to see?
It should connect.
What did you see instead?
SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable
What version of Swoole are you using (show your
php --ri swoole
)?as installed from https://pkgs.alpinelinux.org/packages?name=php82-pecl-swoole&branch=v3.19&repo=community&arch=x86_64&maintainer=
uname -a
&php -v
&gcc -v
) ?$ uname -a Linux 031104a4b74c 6.6.22-linuxkit #1 SMP Fri Mar 29 12:21:27 UTC 2024 aarch64 Linux $ php -v PHP 8.2.18 (cli) (built: Apr 11 2024 14:41:12) (NTS) Copyright (c) The PHP Group Zend Engine v4.2.18, Copyright (c) Zend Technologies $ gcc -v ash: gcc: not found
It may also be that pdo-pgsql is broken but I am not sure where to report it. I would appreciate the guidance. Thank you. :)
The text was updated successfully, but these errors were encountered: