-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[BUG] Nsq服务消费消息没有设置超时时间,会导致进程死锁 #7432
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Execute the command and paste the result below.
Command: uname -a && php -v && composer info | grep hyperf && php --ri swoole
Linux tjcmedium-io-65945d75d9-5xk59 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 Linux
PHP 8.3.8 (cli) (built: Jun 6 2024 17:04:22) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.8, Copyright (c) Zend Technologies
with Zend OPcache v8.3.8, Copyright (c), by Zend Technologies
96qbhy/hyperf-auth 3.1.2 hyperf 的 auth 组件
hyperf/async-queue 3.1.42 A async queue component for hyperf.
hyperf/cache 3.1.43 A cache component for hyperf.
hyperf/code-generator 0.3.3 Code Generator for Hyperf
hyperf/code-parser 3.1.42 A code parser component for Hyperf.
hyperf/codec 3.1.42 A codec component for Hyperf.
hyperf/collection 3.1.47 Hyperf Collection package which come from illuminate/collections
hyperf/command 3.1.42 Command for hyperf
hyperf/conditionable 3.1.42 Hyperf Macroable package which come from illuminate/conditionable
hyperf/config 3.1.42 An independent component that provides configuration container.
hyperf/context 3.1.42 A coroutine/application context library.
hyperf/contract 3.1.42 The contracts of Hyperf.
hyperf/coordinator 3.1.42 Hyperf Coordinator
hyperf/coroutine 3.1.42 Hyperf Coroutine
hyperf/crontab 3.1.42 A crontab component for Hyperf.
hyperf/database 3.1.47 A flexible database library.
hyperf/db-connection 3.1.44 A hyperf db connection handler for hyperf/database.
hyperf/di 3.1.42 A DI for Hyperf.
hyperf/dispatcher 3.1.42 A HTTP Server for Hyperf.
hyperf/engine 2.12.0 Coroutine engine provided by swoole.
hyperf/engine-contract 1.11.0 Contract for Coroutine Engine
hyperf/event 3.1.42 an event manager that implements PSR-14.
hyperf/exception-handler 3.1.42 Exception handler for hyperf
hyperf/filesystem 3.1.42 flysystem integration for hyperf
hyperf/framework 3.1.42 A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices an...
hyperf/guzzle 3.1.42 Swoole coroutine handler for guzzle
hyperf/helper 3.1.47 A function helper package that could help developer solved the problem quickly.
hyperf/http-message 3.1.47 microservice framework base on swoole
hyperf/http-server 3.1.42 A HTTP Server for Hyperf.
hyperf/logger 3.1.42 A logger component for hyperf.
hyperf/macroable 3.1.42 Hyperf Macroable package which come from illuminate/macroable
hyperf/memory 3.1.42 An independent component that use to operate and manage memory.
hyperf/model-cache 3.1.42 A model cache component for hyperf.
hyperf/model-listener 3.1.42 A model listener for Hyperf.
hyperf/nsq 3.1.42 A nsq library for Hyperf.
hyperf/paginator 3.1.42 A paginator component for hyperf.
hyperf/pipeline 3.1.42 Hyperf Macroable package which come from illuminate/pipeline
hyperf/polyfill-coroutine 3.1.42 This component provides features added short functions.
hyperf/pool 3.1.42 An independent universal connection pool component.
hyperf/process 3.1.42 A process component for hyperf.
hyperf/redis 3.1.42 A redis component for hyperf.
hyperf/resource 3.1.42 A api resource component for hyperf.
hyperf/serializer 3.1.42 A serializer component for Hyperf.
hyperf/server 3.1.42 A base server library for Hyperf.
hyperf/signal 3.1.47 A signal library for Hyperf.
hyperf/snowflake 3.1.42 A snowflake library
hyperf/socketio-server 3.1.42 Socket.io implementation for hyperf
hyperf/stdlib 3.1.42 A stdlib component for Hyperf.
hyperf/stringable 3.1.43 Hyperf Stringable package which come from illuminate/support
hyperf/support 3.1.47 A support component for Hyperf.
hyperf/tappable 3.1.42 Hyperf Macroable package which come from illuminate/tappable
hyperf/translation 3.1.42 An independent translation component, forked by illuminate/translation.
hyperf/utils 3.1.42 A tools package that could help developer solved the problem quickly.
hyperf/validation 3.1.47 hyperf validation
hyperf/websocket-server 3.1.42 A websocket server library for Hyperf.
mogody/hyperf-permission 3.1.3 hyperf权限管理组件
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.1.4
Built => Sep 5 2024 03:28:04
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.7 3 Sep 2024
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.27.0
zlib => 1.3.1
brotli => E16781312/D16781312
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 => 8388608Hyperf\Nsq\Subscriber 的如下代码:
public function recv()
{
$data = $this->socket->recvAll(8);
//TODO
}recvAll 没有指定超时时间,在nsq服务不可用的时候,会导致hyperf的进程死锁:
Worker_reactor_try_to_exit() (ERRNO 9101): worker exit timeout, forced termination
===================================================================
[FATAL ERROR]: all coroutines (count: 3) are asleep - deadlock!
===================================================================
[Coroutine-2]
--------------------------------------------------------------------
#0 /app/vendor/hyperf/nsq/src/Subscriber.php(38): Swoole\Coroutine\Socket->recvAll()
#1 /app/vendor/hyperf/nsq/src/Nsq.php(94): Hyperf\Nsq\Subscriber->recv()
#2 /app/vendor/hyperf/pool/src/KeepaliveConnection.php(97): Hyperf\Nsq\Nsq->Hyperf\Nsq\{closure}()
#3 /app/vendor/hyperf/nsq/src/Nsq.php(185): Hyperf\Pool\KeepaliveConnection->call()
#4 /app/vendor/hyperf/nsq/src/Nsq.php(90): Hyperf\Nsq\Nsq->call()
#5 /app/vendor/hyperf/socketio-server/src/Room/RedisNsqAdapter.php(67): Hyperf\Nsq\Nsq->subscribe()
#6 /app/vendor/hyperf/support/src/Functions.php(93): Hyperf\SocketIOServer\Room\RedisNsqAdapter->Hyperf\SocketIOServer\Room\{closure}()
#7 /app/vendor/hyperf/socketio-server/src/Room/RedisNsqAdapter.php(66): Hyperf\Support\retry()
#8 /app/vendor/hyperf/coroutine/src/Coroutine.php(80): Hyperf\SocketIOServer\Room\RedisNsqAdapter->Hyperf\SocketIOServer\Room\{closure}()
#9 [internal function]: Hyperf\Coroutine\Coroutine::Hyperf\Coroutine\{closure}()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working