服务端异常处理 报错 Recv is not supported

オープン
#3 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
php
領域
api, backend

調査の方向性

vendor/hyperf/rpc-multiplex/src/Transporter.php:74 から開始し、app/Http/Api/Controller/User/UserController.php:40 の登録リクエストを、stack trace に示されている RPC クライアント呼び出しまで追跡します。リクエストを再現し、Recv がサポートされていない理由を特定してください。原因と、期待されるトランスポートまたはエラーハンドリングの動作が確立され、登録によってこの未処理例外が発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

string(31) "Hyperf\RpcMultiplex\Transporter" [ERROR] Hyperf\RpcMultiplex\Exception\NotSupportException: Recv is not supported. in /www/im/im-api/vendor/hyperf/rpc-multiplex/src/Transporter.php:74 Stack trace: #0 /www/im/im-api/vendor/hyperf/rpc-client/src/Client.php(46): Hyperf\RpcMultiplex\Transporter->recv() #1 /www/im/im-api/vendor/hyperf/rpc-client/src/AbstractServiceClient.php(243): Hyperf\RpcClient\Client->recv() #2 /www/im/im-api/vendor/hyperf/rpc-client/src/ServiceClient.php(53): Hyperf\RpcClient\AbstractServiceClient->checkRequestIdAndTryAgain() #3 /www/im/im-api/vendor/hyperf/rpc-client/src/ServiceClient.php(83): Hyperf\RpcClient\ServiceClient->__request() #4 /www/im/im-api/runtime/container/proxy/App_Rpc_User_UserAuthRpcInterface.rpc-client.proxy.php(13): Hyperf\RpcClient\ServiceClient->__call() #5 /www/im/im-api/app/Http/Api/Controller/User/UserController.php(40): App\Rpc\User\UserAuthRpcInterface_21f1b2f12bc808f3e929d80230a39e41->register() #6 /www/im/im-api/runtime/container/proxy/Hyperf_HttpServer_CoreMiddleware.proxy.php(131): App\Http\Api\Controller\User\UserController->register() #7 /www/im/im-api/runtime/container/proxy/Hyperf_HttpServer_CoreMiddleware.proxy.php(87): Hyperf\HttpServer\CoreMiddleware->handleFound() #8 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Hyperf\HttpServer\CoreMiddleware->process() #9 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest() #10 /www/im/im-api/vendor/hyperf/validation/src/Middleware/ValidationMiddleware.php(83): Hyperf\Dispatcher\HttpRequestHandler->handle() #11 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Hyperf\Validation\Middleware\ValidationMiddleware->process() #12 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest() #13 /www/im/im-api/vendor/mineadmin/support/Middleware/CorsMiddleware.php(29): Hyperf\Dispatcher\HttpRequestHandler->handle() #14 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\CorsMiddleware->process() #15 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest() #16 /www/im/im-api/vendor/mineadmin/support/Middleware/TranslationMiddleware.php(30): Hyperf\Dispatcher\HttpRequestHandler->handle() #17 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\TranslationMiddleware->process() #18 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest() #19 /www/im/im-api/vendor/mineadmin/support/Middleware/RequestIdMiddleware.php(26): Hyperf\Dispatcher\HttpRequestHandler->handle() #20 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\RequestIdMiddleware->process() #21 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest() #22 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpDispatcher.php(35): Hyperf\Dispatcher\HttpRequestHandler->handle() #23 /www/im/im-api/vendor/hyperf/http-server/src/Server.php(112): Hyperf\Dispatcher\HttpDispatcher->dispatch() #24 [internal function]: Hyperf\HttpServer\Server->onRequest() #25 {main}

我的异常处理代码
`

public function handle(Throwable $throwable, ResponseInterface $response)
{
    if ($throwable instanceof HttpException) {
        return $this->response->handleException($throwable);
    }

    if ($throwable instanceof BusinessException) {
        $this->logger->warning($this->format_throwable($throwable));

        return $this->response->fail($throwable->getCode(), $throwable->getMessage());
    }

    $this->logger->error($this->format_throwable($throwable));

    return $this->response->fail(ResultCode::FAIL, 'Server Error');
}

public function isValid(Throwable $throwable): bool
{
    return true;
}

function format_throwable(Throwable $throwable): string
{
    return $this->container->get(FormatterInterface::class)->format($throwable);
}

}`

主要言語
PHP
スター
7
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。