Skip to content
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

Swoole alpine php8.3 composer fails with a segfault #45

Closed
ghost opened this issue Nov 27, 2023 · 10 comments
Closed

Swoole alpine php8.3 composer fails with a segfault #45

ghost opened this issue Nov 27, 2023 · 10 comments
Assignees

Comments

@ghost
Copy link

ghost commented Nov 27, 2023

Hello, after updating the alpine php base image to v8.3.0, ext-swoole is installed and the application is running, but composer can neither install nor update.

  1. What did you do? If possible, provide a simple script for reproducing the error.
docker run -it --rm phpswoole/swoole:php8.3-alpine sh
composer init

Define any dependency or try to require later, e.g.:

composer require roave/security-advisories
  1. What did you expect to see?

Composer installation

  1. What did you see instead?

Segmentation fault

  1. What version of Swoole are you using (show your php --ri swoole)?

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 5.1.1
Built => Nov 27 2023 04:49:08
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.1.4 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => 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

@liulyn
Copy link

liulyn commented Nov 27, 2023 via email

@deminy
Copy link
Member

deminy commented Nov 28, 2023

Thanks for reporting the issue. Reassigning to @matyhtf .

Steps to reproduce:

docker run --rm -ti phpswoole/swoole:5.1.1-php8.3-dev composer self-update ; echo $?

vs

docker run --rm -ti phpswoole/swoole:5.1.1-php8.2-dev composer self-update ; echo $?

@ghost
Copy link
Author

ghost commented Dec 2, 2023

This seems to be a problem with swoole-curl. If I build the image without that configuration, deminy's test passes. So does the issue belong more to swoole-src itself?

--enable-sockets --enable-swoole-curl && \

Composer self-updates without swoole-curl:

docker-php-ext-configure swoole \
        --enable-mysqlnd      \
        --enable-swoole-pgsql \
        --enable-openssl      \
        --enable-sockets && \
docker-php-ext-install -j$(nproc) swoole && \

@deminy
Copy link
Member

deminy commented Dec 2, 2023

@devrla Yep, there could be new changes made to the curl extension between PHP 8.2 and 8.3, and the Swoole team didn't have those integrated into Swoole.

The team is aware of the issue and is working on a fix. In the meantime, removing/disabling installation option --enable-swoole-curl could be a temporary workaround to play with Swoole 5.1.1 on PHP 8.3, although I haven't yet tried it by myself.

Thanks

@ghost
Copy link
Author

ghost commented Dec 2, 2023

@deminy Thanks, the temporary workaround works for us. 👍

@mlocati
Copy link

mlocati commented Dec 13, 2023

Installing swoole with --enable-swoole-curl set to yes leads to segmentation fault on Debian too (non only on Alpine).

Here's a sample script that causes segmentation fault if swoole is compiled with curl support: https://github.com/mlocati/docker-php-extension-installer/blob/2.1.69/scripts/tests/swoole

@ghost
Copy link
Author

ghost commented Dec 13, 2023

@mlocati We use the php extension installer for our images 👍

The issue has already been fixed
swoole/swoole-src#5206

But while this test now passes...

docker run --rm -ti phpswoole/swoole:php8.3-alpine composer self-update ; echo $?

...a running container does not:

docker run --rm -ti phpswoole/swoole:php8.3-alpine sh
/var/www # composer self-update
Segmentation fault

Both behaviors probably have the same cause?

@ghost
Copy link
Author

ghost commented Dec 21, 2023

I have now tested all the variations from this thread again with the latest swoole alpine image. Both the composer and curl requests run without errors. The builds of our PHP 8.3 alpine images with Swoole extension are also successful. So I think the issue can be closed. Thanks to everyone who was involved in the solution.

@ghost ghost closed this as completed Dec 21, 2023
@tiagomichaelsousa
Copy link

Hello there, is it possible to release also the changes for 5.1.1-php8.3-alpine?

From what I saw in GitHub workflows it will probably need a merge from the main branch to the 5.1.1 branch to update the image.

Thank you in advance 🙏

@deminy
Copy link
Member

deminy commented Dec 26, 2023

@tiagomichaelsousa Unfortunately we can't. Docker image 5.1.1-php8.3-alpine was built for v5.1.1 of Swoole. The issue will be fixed in the next release of Swoole, but not in the released version (v5.1.1).

However, there are nightly images built using latest source code of Swoole from the master branch. Please feel free to try them (e.g., php8.3-alpine) a try and let us know if there are any questions.

This issue was closed.
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

No branches or pull requests

5 participants