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

A bug occurred in Swoole-v5.1.1, please report it. #5306

Open
fpysky opened this issue Apr 26, 2024 · 19 comments
Open

A bug occurred in Swoole-v5.1.1, please report it. #5306

fpysky opened this issue Apr 26, 2024 · 19 comments

Comments

@fpysky
Copy link

fpysky commented Apr 26, 2024

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error.
    [2024-04-26 10:18:00 $32504.0] WARNING Server::check_worker_exit_status(): worker(pid=33336, id=12) abnormal exit, status=0, signal=11
    A bug occurred in Swoole-v5.1.1, please report it.
    The Swoole developers probably don't know about it,
    and unless you report it, chances are it won't be fixed.
    You can read How to report a bug doc before submitting any bug reports:

https://github.com/swoole/swoole-src/blob/master/.github/ISSUE.md
Please do not send bug reports in the mailing list or personal letters.
The issue page is also suitable to submit feature requests.

OS: Linux 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64
GCC_VERSION: 11.4.0
OPENSSL_VERSION: OpenSSL 3.0.2 15 Mar 2022
PHP_VERSION : 8.1.26

  1. What did you expect to see?

  2. What did you see instead?

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

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 5.1.1
Built => Dec 1 2023 13:40:59
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.2 15 Mar 2022
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => 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 => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
    uname -a
    Linux feng-dev 6.5.0-28-generic aaaaa #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

php8.1 -v
PHP 8.1.28 (cli) (built: Apr 22 2024 09:45:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.28, Copyright (c) Zend Technologies
with Zend OPcache v8.1.28, Copyright (c), by Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu122.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1
22.04)

框架环境:hyperf 3.1

@NathanFreeman
Copy link
Member

NathanFreeman commented Apr 26, 2024

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 35353
[New LWP 35357]
[New LWP 35358]
[New LWP 35359]
[New LWP 35360]
[New LWP 35361]
[New LWP 35362]
[New LWP 35363]
[New LWP 35364]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x0000701e81725e2e in epoll_wait (epfd=34, events=0x5a8a6efd1d70, maxevents=4096, timeout=1000) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30 ../sysdeps/unix/sysv/linux/epoll_wait.c: 没有那个文件或目录.

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word". Attaching to process 35353 [New LWP 35357] [New LWP 35358] [New LWP 35359] [New LWP 35360] [New LWP 35361] [New LWP 35362] [New LWP 35363] [New LWP 35364] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x0000701e81725e2e in epoll_wait (epfd=34, events=0x5a8a6efd1d70, maxevents=4096, timeout=1000) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30 30 ../sysdeps/unix/sysv/linux/epoll_wait.c: 没有那个文件或目录.

这是 gdb -p master进程ID

@NathanFreeman
Copy link
Member

https://wiki.swoole.com/zh-cn/#/other/issue?id=关于段错误核心转储
看看能不能生成core文件,或者把SWOOLE_PROCESS模式换成SWOOLE_BASE模式,看看这问题还会不会发生

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

https://wiki.swoole.com/zh-cn/#/other/issue?id=关于段错误核心转储 看看能不能生成core文件,或者把SWOOLE_PROCESS模式换成SWOOLE_BASE模式,看看这问题还会不会发生

改成SWOOLE_BASE错误依旧,生成core文件要重新编译swoole扩展,不过我是通过apt install php8.1-swoole 这种方式安装的,重新编译相同版本的安装就不知道能不能复现了,我可以试试

@NathanFreeman
Copy link
Member

看一下php -m输出一下扩展列表

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
http
iconv
igbinary
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
raphf
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
tokenizer
xdebug
xml
xmlreader
xmlwriter
xsl
yaml
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache

@NathanFreeman
Copy link
Member

屏蔽掉Xdebug试试看

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

卸载xdebug就正常了,不是说8.1后xdebug可以用了吗

@NathanFreeman
Copy link
Member

NathanFreeman commented Apr 26, 2024

php --ri xdebug看看xdebug详细信息,swoole5.1修改过一次跟xdebug有关的bug,可能是新的问题,我要看看

@fpysky
Copy link
Author

fpysky commented Apr 26, 2024

xdebug


\ \ / / | | | |
\ V / __| | _| | _ _ __ _

< / |/ _ \ '_ \| | | |/ _ |
/ . \ (
| | / |) | || | (| |
/
/ __,|_
|.__/ _,|_, |
/ |
|
_/

Version => 3.3.2
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support

         Enabled Features (through 'xdebug.mode' setting)             

Feature => Enabled/Disabled
Development Helpers => ✔ enabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✘ disabled
Tracing => ✘ disabled

                        Optional Features                            

Compressed File Support => yes (gzip)
Clock Source => clock_gettime
'xdebug://gateway' pseudo-host support => yes
'xdebug://nameserver' pseudo-host support => yes
Systemd Private Temp Directory => not enabled

Directive => Local Value => Master Value
xdebug.mode => develop => develop
xdebug.start_with_request => default => default
xdebug.start_upon_error => default => default
xdebug.output_dir => /tmp => /tmp
xdebug.use_compression => 1 => 1
xdebug.trigger_value => no value => no value
xdebug.file_link_format => no value => no value
xdebug.filename_format => no value => no value
xdebug.control_socket => time: 25ms => time: 25ms
xdebug.log => no value => no value
xdebug.log_level => 7 => 7
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
xdebug.max_nesting_level => 512 => 512
xdebug.cli_color => 0 => 0
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.halt_level => 0 => 0
xdebug.max_stack_frames => -1 => -1
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.profiler_append => Off => Off
xdebug.cloud_id => no value => no value
xdebug.client_host => localhost => localhost
xdebug.client_port => 9003 => 9003
xdebug.discover_client_host => Off => Off
xdebug.client_discovery_header => HTTP_X_FORWARDED_FOR,REMOTE_ADDR => HTTP_X_FORWARDED_FOR,REMOTE_ADDR
xdebug.idekey => no value => no value
xdebug.connect_timeout_ms => 200 => 200
xdebug.scream => Off => Off
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_params => On => On
xdebug.collect_return => Off => Off
xdebug.auto_trace => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.collect_includes => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.collect_vars => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.coverage_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.default_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.overload_var_dump => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.profiler_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_autostart => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_connect_back => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_host => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log_level => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_mode => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_port => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_timeout => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.show_mem_delta => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.trace_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)

@NathanFreeman
Copy link
Member

我没法复现这个问题,看看能不能提供一份最小化代码以供复现

@fpysky
Copy link
Author

fpysky commented Apr 28, 2024

hyperf-demo.zip

@dhobi
Copy link

dhobi commented Apr 30, 2024

Sorry for hijacking this thread. I just wanted to share my observation that crashes stop happening for me when I disable the xdebug (3.3.2) extension.

php8.3-swoole5.1.1

When does the crash happen:
The crash, if xdebug is enabled, happens in a task worker which is listening for events on a redis queue (subscribe). Whenever the redis connection is forcibly closed by the redis server (due to inactivity), the task worker crashes and is automatically restarted by swoole.
If xdebug is not enabled, my code is able to handle the close event and create a new redis client & subscribe like intended.

@NathanFreeman
Copy link
Member

@fpysky 我发现是xdebug的max_nesting_level参数设置成了512,如果是某个循环超过512次,就会抛出PHP Fatal error直接终止进程

@NathanFreeman
Copy link
Member

@dhobi I found that the max_nesting_level parameter of xdebug is set to 512. If a certain loop exceeds 512 times, a PHP Fatal error will be thrown, terminating the process.

@dhobi
Copy link

dhobi commented May 19, 2024

@NathanFreeman thx for this! What is your proposed fix / workaround here? Simply raise max_nesting_level to a higher number? Would it help if I test it with my "crashing scenario"?

@linuxd3v
Copy link

I've raised the max_nesting_level in xdebug to 50000, but this bug still happens.
xdebug 3.3.2, xdebug.max_nesting_level => 50000 => 50000

sandbox-sb.6red-swoole8.1  | [2024-05-20 13:05:00 #12.0]        WARNING Server::check_worker_exit_status(): worker(pid=60, id=9) abnormal exit, status=0, signal=11
sandbox-sb.6red-swoole8.1  | A bug occurred in Swoole-v5.1.1, please report it.
sandbox-sb.6red-swoole8.1  | The Swoole developers probably don't know about it,
sandbox-sb.6red-swoole8.1  | and unless you report it, chances are it won't be fixed.
sandbox-sb.6red-swoole8.1  | You can read How to report a bug doc before submitting any bug reports:
sandbox-sb.6red-swoole8.1  | >> https://github.com/swoole/swoole-src/blob/master/.github/ISSUE.md 
sandbox-sb.6red-swoole8.1  | Please do not send bug reports in the mailing list or personal letters.
sandbox-sb.6red-swoole8.1  | The issue page is also suitable to submit feature requests.
sandbox-sb.6red-swoole8.1  | 
sandbox-sb.6red-swoole8.1  | OS: Linux 6.2.0-1012-aws #12~22.04.1-Ubuntu SMP Thu Sep  7 14:01:24 UTC 2023 x86_64
sandbox-sb.6red-swoole8.1  | GCC_VERSION: 11.4.0
sandbox-sb.6red-swoole8.1  | OPENSSL_VERSION: OpenSSL 3.0.2 15 Mar 2022
sandbox-sb.6red-swoole8.1  | PHP_VERSION : 8.1.2-1ubuntu2.17
sandbox-sb.6red-swoole8.1  | 
sandbox-sb.6red-swoole8.1  | [2024-05-20T09:05:00.530238-04:00] MWCOM-APP.NOTICE: WorkerErrorListener:closePools (workerId = 9)

@NathanFreeman
Copy link
Member

@dhobi @linuxd3v I don't have a good solution for xdebug. There are too many configurations for xdebug, unless we can find out through the logs which specific configuration is causing PHP to throw a fatal error.

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

4 participants