hyperf-admin server:watch 报错 WARNING Worker_reactor_try_to_exit

在使用hyperf-admin组件时,用 hyperf官方的 热更新 watch server:watch 时,启动成功,但是修改任何文件都是报以下错误:

[2021-05-15 11:03:43 #936.4]    INFO    Server is shutdown now
[2021-05-15 11:03:46 *948.2]    WARNING Worker_reactor_try_to_exit (ERRNO 9012):
 worker exit timeout, forced termination

===================================================================
 [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock!
===================================================================

 [Coroutine-2]
--------------------------------------------------------------------
#0  usleep() called at [/data/project/virtual-currency/vendor/hyperf/utils/src/B
ackoff.php:65]
#1  Hyperf\Utils\Backoff->sleep() called at [/data/project/virtual-currency/vend
or/hyperf/utils/src/Functions.php:85]
#2  retry() called at [/data/project/virtual-currency/vendor/hyperf/metric/src/M
etricSetter.php:68]
#3  Hyperf\Metric\Listener\OnWorkerStart->Hyperf\Metric\{closure}() called at [/
data/project/virtual-currency/vendor/hyperf/utils/src/Functions.php:272]
#4  call() called at [/data/project/virtual-currency/vendor/hyperf/utils/src/Cor
outine.php:62]

swoole官网的解释是:在约定的时间 (max_wait_time 秒) 内此 Worker 没有退出,Swoole 底层强行终止此进程。照成2个协程发生死锁。

在不使用 hyperf-admin 组件时,server:watch 没有问题。加了 hyperf-admin 组件之后,就会报错。不知道是 hyperf-admin 的BUG还是 server:watch的问题。

环境:

裸机跑环境,没有上docket
swoole 4.6.6
php 7.4
hyperf 2.0
mysql 5.7
redis 6.2

 

这里先记录一下,有哪位大佬解答一下。

以下是重现步骤:

  1. 安装 swoole 4.6.6
    phpize && ./configure --enable-openssl --enable-http2 -with-php-config=/www/server/php/74/bin/php-config && make && sudo make install

    安装成功

  2. 安装 hyperf 框架
     

    composer create-project hyperf/hyperf-skeleton
    

    一路 n 回车

  3. 启动项目,hyperf 框架启动成功

    [root@xxxxxxxx hyperf-skeleton]# php bin/hyperf.php start
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Process\Listener\BootProcessListener listener.
    [DEBUG] Event Hyperf\Framework\Event\OnStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    [INFO] Worker#1 started.
    [DEBUG] Event Hyperf\Framework\Event\OnManagerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    [INFO] Worker#3 started.
    [INFO] Worker#2 started.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    [INFO] Worker#0 started.
    [INFO] HTTP Server listening at 0.0.0.0:9501
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
    [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
    

     

  4. 安装 热更新 Watcher

    [root@xxxxxxx hyperf-skeleton]# php bin/hyperf.php server:watch
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    Continue as root/super user [yes]? yes
    Generating optimized autoload files
    Generated optimized autoload files containing 3337 classes
    
    Start server ...
    #!/usr/bin/env php
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
    [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
    

     

  5. 安装 hyperf-admin

    [root@xxxxx hyperf-skeleton]# composer require hyperf-admin/hyperf-admin -W
    


     

  6. 启动server:watch

    [root@xxxxx hyperf-skeleton]# php bin/hyperf.php server:watch
    

  7. 监听成功,接下来去修改任意文件

    问题重现了

     

    [2021-05-15 19:54:48 #20732.4]	INFO	Server is shutdown now
    [2021-05-15 19:54:51 *20741.3]	WARNING	Worker_reactor_try_to_exit (ERRNO 9012): worker exit timeout, forced termination
    
    ===================================================================
     [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock!
    ===================================================================
    
     [Coroutine-2]
    --------------------------------------------------------------------
    #0  usleep() called at [/www/wwwroot/hyperf-skeleton/vendor/hyperf/utils/src/Backoff.php:65]
    #1  Hyperf\Utils\Backoff->sleep() called at [/www/wwwroot/hyperf-skeleton/vendor/hyperf/utils/src/Functions.php:85]
    #2  retry() called at [/www/wwwroot/hyperf-skeleton/vendor/hyperf/metric/src/MetricSetter.php:68]
    #3  Hyperf\Metric\Listener\OnWorkerStart->Hyperf\Metric\{closure}() called at [/www/wwwroot/hyperf-skeleton/vendor/hyperf/utils/src/Functions.php:271]
    #4  call() called at [/www/wwwroot/hyperf-skeleton/vendor/hyperf/utils/src/Coroutine.php:62]
    
    [2021-05-15 19:54:51 *20739.1]	WARNING	Worker_reactor_try_to_exit (ERRNO 9012): worker exit timeout, forced termination
    [2021-05-15 19:54:51 *20738.0]	WARNING	Worker_reactor_try_to_exit (ERRNO 9012): worker exit timeout, forced termination
    
    ===================================================================
    ===================================================================
     [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock!
     [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock!
    ===================================================================
    
    ===================================================================
    
     [Coroutine-2]
     [Coroutine-2]
    --------------------------------------------------------------------
    

    个人理解大致说的是:reactor向worker进程发送 终止信号,但是worker超时没有终止,报warning错误。有一个协程sleep,产生死锁。  是引入了 hyperf-admin 组件之后,才出现的,不知道 组件里面 哪个地方 产生了死锁。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值