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 crashes with curl 8.12.0 #5680

Open
hydrapolic opened this issue Feb 8, 2025 · 9 comments
Open

swoole crashes with curl 8.12.0 #5680

hydrapolic opened this issue Feb 8, 2025 · 9 comments

Comments

@hydrapolic
Copy link
Contributor

hydrapolic commented Feb 8, 2025

When building a Docker image from php:8.3.16-alpine3.21 with recent curl 8.12.0, we are starting to see abnormal memory usage (kubernetes killing pods with signal=9) and segfaults (signal=11).

FROM php:8.3.16-alpine3.21

RUN apk upgrade --no-cache \
    && apk add --no-cache \
    curl-dev

RUN pecl install -D 'enable-openssl="yes" enable-swoole-curl="yes" enable-cares="yes"' swoole-5.1.6 \
    && docker-php-ext-enable swoole

The update in alpine: https://gitlab.alpinelinux.org/alpine/aports/-/commit/5a64e9bcdd3db0b4aa6dba0dabc8b88f4bbd9d10

With the previous curl version, everything was ok.

Maybe related:
curl/curl#16236
curl/curl#16216
curl/curl#16253

@kurumii
Copy link

kurumii commented Feb 8, 2025

I also encountered a similar problem, which has now affected our business. What method did you use to recover? We are currently using the container id of the previous version

@NathanFreeman
Copy link
Member

Please check whether the curl versions required by PHP and Swoole are consistent. PHP and Swoole need to depend on the same version of curl.

@kurumii
Copy link

kurumii commented Feb 8, 2025

Please check whether the curl versions required by PHP and Swoole are consistent. PHP and Swoole need to depend on the same version of curl.

请问如何查看swoole的curl版本?

/opt/www # php -i | grep "cURL"
cURL support => enabled
cURL Information => 8.12.0

/opt/www # php --ri swoole | grep cURL

/opt/www # php --ri swoole | grep cu
curl-native => enabled

/opt/www # php --ri swoole | grep c
Author => Swoole Team <[email protected]>
coroutine => enabled with boost asm context
spinlock => enabled
rwlock => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
mutex_timedlock => enabled
async_redis => enabled
coroutine_pgsql => enabled
coroutine_odbc => enabled
coroutine_sqlite => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
/opt/www # 

@NathanFreeman
Copy link
Member

Please run php --ri swoole and show me the detailed output.

@kurumii
Copy link

kurumii commented Feb 8, 2025

Please run php --ri swoole and show me the detailed output.

这是执行后的结果,非常感谢你的指导

/opt/www # php --ri swoole 

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.1.3
Built => Jul 25 2024 02:11:01
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.6 4 Jun 2024
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
async_redis => enabled
coroutine_pgsql => enabled
coroutine_odbc => enabled
coroutine_sqlite => 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 => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
/opt/www # 

@NathanFreeman
Copy link
Member

Please try running find / -name libcurl.pc to check if there are multiple versions of cURL installed. If multiple versions are found, you can specify the path to the desired cURL version (e.g., 8.12) when compiling Swoole by using the export PKG_CONFIG_PATH= command.

@hydrapolic
Copy link
Contributor Author

php --ri swoole

/var/www # php --ri swoole
swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.1.6
Built => Feb  7 2025 18:22:02
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.3.2 3 Sep 2024
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
c-ares => 1.34.3
zlib => 1.3.1
brotli => E16781312/D16781312
mutex_timedlock => enabled
pthread_barrier => enabled
async_redis => 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

@hydrapolic
Copy link
Contributor Author

Please try running find / -name libcurl.pc to check if there are multiple versions of cURL installed. If multiple versions are found, you can specify the path to the desired cURL version (e.g., 8.12) when compiling Swoole by using the export PKG_CONFIG_PATH= command.

# find / -name libcurl.pc
/usr/lib/pkgconfig/libcurl.pc
# cat /usr/lib/pkgconfig/libcurl.pc
...

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
supported_protocols="DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS IPFS IPNS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP WS WSS"
supported_features="alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM PSL SSL threadsafe TLS-SRP UnixSockets zstd"

Name: libcurl
URL: https://curl.se/
Description: Library to transfer files with HTTP, FTP, etc.
Version: 8.12.0
Requires: 
Requires.private: libidn2,zlib,libbrotlidec,libzstd,openssl,libpsl,libnghttp2,libcares
Libs: -L${libdir} -lcurl 
Libs.private:  -lcares -lnghttp2 -lidn2 -lpsl -lssl -lcrypto -lssl -lcrypto -lzstd -lbrotlidec -lz
Cflags: -I${includedir} 
Cflags.private: -DCURL_STATICLIB

@hydrapolic
Copy link
Contributor Author

Alpine reverted curl to 8.11.1, now the crashes are gone: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16900

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

3 participants