-
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
[bug] 偶现,在脚本中使用大量go(function () {})处理任务偶尔会卡死在epoll_wait #5621
Comments
多协程并行要用 |
|
这一般都是你的 php 代码层面存在逻辑错误,主线程在 epoll_wait 处轮询是符合预期的,没有任何事件时将进入 epoll 等待。 你可以记录协程 id,然后通过 |
感谢,我通过这个方式再尝试下定位。 |
我这边也遇到类似的问题 不停创建协程进入阻塞时会遇到 该问题 协程1 调用$lock->lock() ;sleep(1);$lock->unlock() ; 协程3调用 $lock->lock();sleep(1); $lock->unlock() ; 通常代替方案 浪费点性能 解决这个问题 至于chan没有检查是否阻塞 那就没办法了 |
|
协程中不能用互斥锁和sleep,容易导致死锁 |
while($chan->isFull())usleep(1000*10);#10ms#等待 通道有空位置#协程挂起#让出cpu 希望官方能换个阻塞处理方式吧 |
Channel 本身就具有协程同步的能力,不需要使用锁。相反如果使用了锁,可能会导致进程死锁。 目前 |
Please answer these questions before submitting your issue.
不是在http_server中运行,是在脚本模式下
What did you expect to see?
期望能正常执行完任务
What did you see instead?
进程停在了epoll_wait
php --ri swoole
)?swoole
Swoole => enabled
Author => Swoole Team [email protected]
Version => 4.8.13
Built => Nov 13 2023 15:55:26
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1k FIPS 25 Mar 2021
dtls => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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
swoole
Swoole => enabled
Author => Swoole Team [email protected]
Version => 5.1.2
Built => Aug 13 2024 17:02:50
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.12 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
zlib => 1.2.13
brotli => E16781312/D16781312
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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
6. What is your machine environment used (show your
uname -a
&php -v
&gcc -v
) ?PHP 7.4.12
PHP 8.3.7
2个php版本和swoole版本都存在这个问题,不过是偶现,没有任何报错,进程就卡死在epoll_wait上,请问有人遇到过类似的问题吗?
The text was updated successfully, but these errors were encountered: