friendsofhyperf / components

🚀 The most popular components for Hyperf. https://hyperf.fans/
MIT License
78 stars 18 forks source link

sentry组件,执行命令行报错 #627

Closed tw2066 closed 6 months ago

tw2066 commented 6 months ago

执行命令

 php bin/hyperf.php foo

报错信息

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

 [Coroutine-3]
--------------------------------------------------------------------
#0 /Users/php-service/vendor/hyperf/engine/src/Channel.php(41): Swoole\Coroutine\Channel->pop()
#1 /Users/php-service/runtime/container/proxy/Hyperf_Coordinator_Coordinator.proxy.php(37): Hyperf\Engine\Channel->pop()
#2 /Users/php-service/vendor/hyperf/di/src/Aop/ProceedingJoinPoint.php(57): Hyperf\Coordinator\Coordinator->Hyperf\Coordinator\{closure}()
#3 /Users/php-service/vendor/hyperf/di/src/Aop/ProxyTrait.php(87): Hyperf\Di\Aop\ProceedingJoinPoint->processOriginalMethod()
#4 /Users/php-service/vendor/hyperf/pipeline/src/Pipeline.php(98): Hyperf\Coordinator\Coordinator::Hyperf\Di\Aop\{closure}()
#5 /Users/php-service/vendor/hyperf/di/src/Aop/ProceedingJoinPoint.php(46): Hyperf\Pipeline\Pipeline::Hyperf\Pipeline\{closure}()
#6 /Users/php-service/vendor/friendsofhyperf/sentry/src/Tracing/Aspect/CoordinatorAspect.php(50): Hyperf\Di\Aop\ProceedingJoinPoint->process()
#7 /Users/php-service/vendor/hyperf/di/src/Aop/Pipeline.php(31): FriendsOfHyperf\Sentry\Tracing\Aspect\CoordinatorAspect->process()
#8 /Users/php-service/vendor/hyperf/pipeline/src/Pipeline.php(81): Hyperf\Di\Aop\Pipeline->Hyperf\Di\Aop\{closure}()
#9 /Users/php-service/vendor/hyperf/di/src/Aop/ProxyTrait.php(88): Hyperf\Pipeline\Pipeline->then()
#10 /Users/php-service/vendor/hyperf/di/src/Aop/ProxyTrait.php(31): Hyperf\Coordinator\Coordinator::handleAround()
#11 /Users/php-service/runtime/container/proxy/Hyperf_Coordinator_Coordinator.proxy.php(39): Hyperf\Coordinator\Coordinator::__proxyCall()
#12 /Users/php-service/vendor/friendsofhyperf/sentry/src/HttpClient/HttpClient.php(109): Hyperf\Coordinator\Coordinator->yield()
#13 [internal function]: FriendsOfHyperf\Sentry\HttpClient\HttpClient->FriendsOfHyperf\Sentry\HttpClient\{closure}()

 [Coroutine-2]
--------------------------------------------------------------------
#0 /Users/php-service/vendor/hyperf/engine/src/Channel.php(41): Swoole\Coroutine\Channel->pop()
#1 /Users/php-service/vendor/friendsofhyperf/sentry/src/HttpClient/HttpClient.php(84): Hyperf\Engine\Channel->pop()
#2 [internal function]: FriendsOfHyperf\Sentry\HttpClient\HttpClient->FriendsOfHyperf\Sentry\HttpClient\{closure}()

[2024-05-17 10:41:32 @40337.0]  WARNING Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
[2024-05-17 10:41:32 @40337.0]  WARNING Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
huangdijia commented 6 months ago
composer info|grep sentry

把 foo 命令的源码也发一下。

tw2066 commented 6 months ago
➜  php-service git:(master) ✗ composer info|grep sentry 
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).
A script named update would override a Composer command and has been skipped
friendsofhyperf/sentry                v3.1.22.6  The sentry component for Hyperf.
sentry/sentry                         4.7.0      PHP SDK for Sentry (http://sentry.io)

foo 命令的源码

<?php

declare(strict_types=1);

namespace App\Command;

use Hyperf\Command\Annotation\Command;
use Hyperf\Command\Command as HyperfCommand;
use Psr\Container\ContainerInterface;

#[Command]
class FooCommand extends HyperfCommand
{

    public function __construct(protected ContainerInterface $container)
    {
        parent::__construct('foo');
    }

    public function configure()
    {
        parent::configure();
        $this->setDescription('Hyperf Demo Command');
    }

    public function handle()
    {
        var_dump('......');
    }
}
huangdijia commented 6 months ago

handle 方法里面加入一些 IO,比如 sleep(1) 试试看

tw2066 commented 6 months ago

一样的,同样的错误

huangdijia commented 6 months ago

我还是不能复现你的问题,把 Hyperf 的版本都打印出来我看看

composer info|grep hyperf
tw2066 commented 6 months ago
➜  php-service git:(master) ✗ composer info | grep hyperf
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).
A script named update would override a Composer command and has been skipped
free2one/hyperf-php-accessor          0.2.3      PHP Accessor SDK for Hyperf framework
friendsofhyperf/lock                  v3.1.20    The lock component for Hyperf.
friendsofhyperf/sentry                v3.1.22.6  The sentry component for Hyperf.
friendsofhyperf/telescope             v3.1.24    An elegant debug assistant for the hyperf framework.
friendsofhyperf/tinker                v3.1.23    The Powerful REPL for Hyperf.
hyperf/amqp                           v3.1.21    A amqplib for hyperf.
hyperf/async-queue                    v3.1.15    A async queue component for hyperf.
hyperf/cache                          v3.1.15    A cache component for hyperf.
hyperf/circuit-breaker                v3.1.15    A circuit breaker component for hyperf.
hyperf/code-generator                 v0.3.3     Code Generator for Hyperf
hyperf/code-parser                    v3.1.15    A code parser component for Hyperf.
hyperf/codec                          v3.1.15    A codec component for Hyperf.
hyperf/collection                     v3.1.22    Hyperf Collection package which come from illuminate/collections
hyperf/command                        v3.1.22    Command for hyperf
hyperf/conditionable                  v3.1.15    Hyperf Macroable package which come from illuminate/conditionable
hyperf/config                         v3.1.15    An independent component that provides configuration container.
hyperf/config-center                  v3.1.15    The abstraction component of config center
hyperf/config-nacos                   v3.1.15    A nacos adapter for config center component.
hyperf/context                        v3.1.15    A coroutine/application context library.
hyperf/contract                       v3.1.15    The contracts of Hyperf.
hyperf/coordinator                    v3.1.21    Hyperf Coordinator
hyperf/coroutine                      v3.1.15    Hyperf Coroutine
hyperf/crontab                        v3.1.19    A crontab component for Hyperf.
hyperf/dag                            v3.1.15    Dag runner for hyperf
hyperf/database                       v3.1.22    A flexible database library.
hyperf/database-pgsql                 v3.1.22    A pgsql handler for hyperf/database.
hyperf/db                             v3.1.22   
hyperf/db-connection                  v3.1.15    A hyperf db connection handler for hyperf/database.
hyperf/devtool                        v3.1.19    A Devtool for Hyperf.
hyperf/di                             v3.1.15    A DI for Hyperf.
hyperf/dispatcher                     v3.1.15    A HTTP Server for Hyperf.
hyperf/elasticsearch                  v3.1.15    Elasticsearch client for hyperf
hyperf/engine                         v2.11.0    Coroutine engine provided by swoole.
hyperf/engine-contract                v1.10.1    Contract for Coroutine Engine
hyperf/event                          v3.1.15    an event manager that implements PSR-14.
hyperf/exception-handler              v3.1.22    Exception handler for hyperf
hyperf/filesystem                     v3.1.15    flysystem integration for hyperf
hyperf/framework                      v3.1.15    A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.
hyperf/grpc                           v3.1.21    A GRPC basic library for Hyperf.
hyperf/grpc-client                    v3.1.22    A GRPC Client for Hyperf.
hyperf/grpc-server                    v3.1.15    A GRPC Server for Hyperf.
hyperf/guzzle                         v3.1.15    Swoole coroutine handler for guzzle
hyperf/http-message                   v3.1.19    microservice framework base on swoole
hyperf/http-server                    v3.1.17    A HTTP Server for Hyperf.
hyperf/http2-client                   v3.1.15    A HTTP2 client library for Hyperf.
hyperf/json-rpc                       v3.1.15    A JSON RPC component for Hyperf RPC Server or Client.
hyperf/kafka                          v3.1.15    A kafka client for Hyperf
hyperf/load-balancer                  v3.1.15    A load balancer library for Hyperf.
hyperf/logger                         v3.1.15    A logger component for hyperf.
hyperf/macroable                      v3.1.15    Hyperf Macroable package which come from illuminate/macroable
hyperf/memory                         v3.1.15    An independent component that use to operate and manage memory.
hyperf/model-listener                 v3.1.15    A model listener for Hyperf.
hyperf/nacos                          v3.1.15    Nacos SDK
hyperf/nsq                            v3.1.15    A nsq library for Hyperf.
hyperf/paginator                      v3.1.15    A paginator component for hyperf.
hyperf/pipeline                       v3.1.15    Hyperf Macroable package which come from illuminate/pipeline
hyperf/pool                           v3.1.15    An independent universal connection pool component.
hyperf/process                        v3.1.15    A process component for hyperf.
hyperf/rate-limit                     v3.1.15    A rate limiter implemented for Hyperf or other coroutine framework
hyperf/redis                          v3.1.18    A redis component for hyperf.
hyperf/resource                       v3.1.15    A api resource component for hyperf.
hyperf/retry                          v3.1.16    A retry component for hyperf.
hyperf/rpc                            v3.1.15    A rpc basic library for Hyperf.
hyperf/rpc-client                     v3.1.15    An abstract rpc server component for Hyperf.
hyperf/rpc-multiplex                  v3.1.20    Rpc for multiplexing connection
hyperf/rpc-server                     v3.1.20    An abstract rpc server component for Hyperf.
hyperf/scout                          v3.1.21    Hyperf Scout provides a driver based solution to searching your Eloquent models. Inspired By Laravel Scout.
hyperf/serializer                     v3.1.22    A serializer component for Hyperf.
hyperf/server                         v3.1.15    A base server library for Hyperf.
hyperf/service-governance             v3.1.15    A service governance component for Hyperf.
hyperf/service-governance-nacos       v3.1.15    A nacos adapter for service governance.
hyperf/session                        v3.1.15    A session library
hyperf/signal                         v3.1.15    A signal library for Hyperf.
hyperf/snowflake                      v3.1.15    A snowflake library
hyperf/socketio-server                v3.1.19    Socket.io implementation for hyperf
hyperf/stdlib                         v3.1.15    A stdlib component for Hyperf.
hyperf/stringable                     v3.1.20    Hyperf Stringable package which come from illuminate/support
hyperf/super-globals                  v3.1.15    A superglobals library for Hyperf.
hyperf/support                        v3.1.15    A support component for Hyperf.
hyperf/tappable                       v3.1.15    Hyperf Macroable package which come from illuminate/tappable
hyperf/task                           v3.1.15    A task library for Hyperf.
hyperf/testing                        v3.1.21    Testing for hyperf
hyperf/token-bucket                   v2.0.0     Implementation of the Token Bucket algorithm.
hyperf/tracer                         v3.1.15    A open tracing system implemented for Hyperf or other coroutine framework
hyperf/translation                    v3.1.15    An independent translation component, forked by illuminate/translation.
hyperf/utils                          v3.1.0     A tools package that could help developer solved the problem quickly.
hyperf/validation                     v3.1.22    hyperf validation
hyperf/view                           v3.1.15    A view library for Hyperf.
hyperf/view-engine                    v3.1.15   
hyperf/watcher                        v3.1.21    Hot reload watcher for Hyperf
hyperf/websocket-server               v3.1.17    A websocket server library for Hyperf.
hyperf/xxl-job-incubator              dev-master php hyperf xxljob
huangdijia commented 6 months ago

看 Hyperf 组件版本跟我本地的也是一致的,再看看 Swoole 的版本啰

php --ri swoole
tw2066 commented 6 months ago
➜  php-service git:(master) ✗ php --ri swoole 

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.0.2
Built => Mar 17 2023 13:13:15
coroutine => enabled with boost asm context
kqueue => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1s  1 Nov 2022
dtls => enabled
http2 => enabled
json => enabled
pcre => enabled
zlib => 1.2.11
async_redis => enabled
coroutine_postgresql => 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 => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
PHP 8.1.27 (cli) (built: Dec 21 2023 17:51:24) (NTS)
Copyright (c) The PHP Groupnfig 
Zend Engine v4.1.27, Copyright (c) Zend Technologies
    with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans
    with Zend OPcache v8.1.27, Copyright (c), by Zend Technologies
huangdijia commented 6 months ago

很奇怪,我这边用的是 swoole 5.1.2 ,你升级试试,或者重新创建一个项目试试看。

tw2066 commented 6 months ago

创建的新项目没问题 , 老项目报错 , 不知道哪里影响了

huangdijia commented 6 months ago

这个错误其实可以不用管

tw2066 commented 6 months ago

OK