PHP中使用gRPC客户端

因为工作需要使用gRPC,本人使用的是windows10,不过linux的操作流程基本一样。

直接进入主题,分为了几部分

1、下载Protoc

下载地址:https://github.com/google/protobuf/releases

这里采用的二进制文件,选择对应的平台,下载
https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-3.7.1-win64.zip

解压后得到,在bin文件夹下的 protoc.exe。我放到 D:\Program Files\protoc-3.7.1-win64\bin 下,并加入到系统环境变量 Path 中,就可以使用 protoc 命令了,可以用 protoc --version 来查看是否成功。(这一步很重要用于生成 protobuf 文件对应的 PHP代码 用的)

2、编写 protocol buffers 文件

如何编写请看 Protobuf3语言指南 写得不错,首先创建一个为 testgrpc_com 项目,我这的位置是 E:\www\testgrpc_com ,在项目下简单写了一个 xuexitest.proto

syntax = "proto3";  // 指定proto版本

package xuexitest; // 指定包名

//定义 Xuexitest 服务
service Xuexitest {
    //定义 SayTest 方法
    rpc SayTest(TestRequest) returns (TestReply) {}
}

//TestRequest 请求结构
message TestRequest {
    int64 typeid = 1;
}

//TestReply 响应结构
message TestReply {
    
   //返回数据类型
    message GetData {
      int64 id = 1;
      string name = 2;
   }
   
   repeated GetData getdataarr = 1;
}

3、下载 PHP的gRPC扩展和protobuf扩展

PHP的gRPC扩展:http://pecl.php.net/package/gRPC

PHP的protobuf扩展: http://pecl.php.net/package/protobuf

注:1、PHP的protobuf扩展没有windows版本的,但不影响使用无非就是运行速度慢点。(使用 composer 加载 protobuf 类库,请看下面的 composer.json 配置文件)

注:2、如何安装PHP扩展,这里就不讲了。

4、编译 protocol buffers 文件

编译 xuexitest.proto 使用 protoc --php_out=. xuexitest.proto 会生成得到:

5、使用 PHP 的 composer

首先 安装 composer 来管理和加载PHP的类库,如何安装这里就不讲了。(这一步也很重要用于解决 Grpc和 protobuf 的PHP类库依赖)

在项目下编写 composer.json 放到刚刚编译 protocol buffers 文件同级下

{
  "name": "grpc-go-php",
  "require": {
    "grpc/grpc": "^v1.3.0",
    "google/protobuf": "^v3.3.0"
  },
  "autoload":{
    "psr-4":{
      "GPBMetadata\\":"GPBMetadata/",
      "Xuexitest\\":"Xuexitest/"
    }
  }
}

6、使用 Composer 下载 PHP 代码

1.进入到项目的目录,如:E:\www\testgrpc_com 中在地址栏输入cmd回车即可

2.在命令提示符(黑窗口)下输入 composer install 回车,等待下载完成。

7、定义PHP的gRPC端户端

在项目的 Xuexitest 文件夹中,新建 XuexitestClient.php 文件

<?php
namespace Xuexitest;

/**
 * service Xuexitest{}
 * 编写 (gprc 定义 Xuexitest 服务)的客户端
 */
class XuexitestClient extends \Grpc\BaseStub{

    public function __construct($hostname, $opts, $channel = null) {
        parent::__construct($hostname, $opts, $channel);
    }

    /**
     * rpc SayTest(TestRequest) returns (TestReply) {}
     * 方法名尽量和 (gprc 定义 Xuexitest 服务)的方法一样
     * 用于请求和响应该服务
     */
    public function SayTest(\Xuexitest\TestRequest $argument,$metadata=[],$options=[]){
        // (/xuexitest.Xuexitest/SayTest) 是请求服务端那个服务和方法,基本和 proto 文件定义一样
        // (\Xuexitest\TestReply) 是响应信息(那个类),基本和 proto 文件定义一样
        return $this->_simpleRequest('/xuexitest.Xuexitest/SayTest',
            $argument,
            ['\Xuexitest\TestReply', 'decode'],
            $metadata, $options);
    }

}

8、编写PHP执行文件

在项目下 新建 xuexitest.php

?php
//引入 composer 的自动载加
require __DIR__ . '/vendor/autoload.php';

//用于连接 服务端
$client = new \Xuexitest\XuexitestClient('127.0.0.1:50052', [
    'credentials' => Grpc\ChannelCredentials::createInsecure()
]);

//实例化 TestRequest 请求类
$request = new \Xuexitest\TestRequest();
$request->setTypeid(1);

//调用远程服务
$get = $client->SayTest($request)->wait();

//返回数组
//$reply 是 TestReply 对象
//$status 是数组
list($reply, $status) = $get;

//数组
$getdata = $reply->getGetdataarr();

foreach ($getdata as $k=>$v){
    echo $v->getId(),'=>',$v->getName(),"\n\r";
}

9、赶快执行下

这是源代码:https://github.com/laixhe/php_grpc

已标记关键词 清除标记
<div class="post-text" itemprop="text"> <p>I am encountering a "Socket Closed" with status <code>UNAVAILABLE(14)</code> with PHP client, the server is written in golang.</p> <p>The same code works only in docker using the php-fpm image <code>php:7.0.6-fpm</code> via browser (CLI fails with the same error), but fails everywhere else including on my Mac with natively installed PHP(7.3.4). I have run a testing Golang client and it works perfectly on the same machines. </p> <p>I have filled an issue on github as suggested by <a href="https://stackoverflow.com/questions/55783516/grpc-on-php-socket-closed#comment98242438_55783516">Zhouyihai Ding</a> <a href="https://github.com/grpc/grpc/issues/18826" rel="nofollow noreferrer">https://github.com/grpc/grpc/issues/18826</a></p> <p>here is the gRPC extension trace output <code>GRPC_VERBOSITY=debug GRPC_TRACE=all</code>, it's truncated due to this posting limit.</p> <pre><code>D0421 14:41:39.308255868 1321 error.cc:127] 0x2b8a660: 2 -> 3 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:595] I0421 14:41:39.308262647 1321 chttp2_transport.cc:2792] set connectivity_state=4 I0421 14:41:39.308287703 1321 connectivity_state.cc:164] SET: 0x7f7668005350 client_transport: READY --> SHUTDOWN [close_transport] error=0x2b8a660 {"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} I0421 14:41:39.308298675 1321 connectivity_state.cc:190] NOTIFY: 0x7f7668005350 client_transport: 0x7f7668003f10 D0421 14:41:39.308305766 1321 error.cc:127] 0x2b8a660: 3 -> 4 [/tmp/pear/temp/grpc/src/core/lib/transport/connectivity_state.cc:192] I0421 14:41:39.308313172 1321 timer_generic.cc:467] TIMER 0x7f76680069f8: CANCEL pending=true I0421 14:41:39.308320240 1321 combiner.cc:167] C:0x7f7668000f20 grpc_combiner_execute c=0x7f7668006840 last=3 D0421 14:41:39.308328283 1321 error.cc:127] 0x2b8a660: 4 -> 5 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:623] I0421 14:41:39.308335236 1321 ev_posix.cc:272] (polling-api) fd_shutdown(3) I0421 14:41:39.308341630 1321 ev_posix.cc:273] (fd-trace) fd_shutdown(3) D0421 14:41:39.308348627 1321 error.cc:127] 0x2b8a660: 5 -> 6 [/tmp/pear/temp/grpc/src/core/lib/iomgr/ev_epoll1_linux.cc:383] E0421 14:41:39.308357648 1321 lockfree_event.cc:164] LockfreeEvent::SetShutdown: 0x7f7668001bd8 curr=(nil) err={"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} D0421 14:41:39.308382658 1321 error.cc:127] 0x2b8a660: 6 -> 7 [/tmp/pear/temp/grpc/src/core/lib/iomgr/ev_epoll1_linux.cc:387] E0421 14:41:39.308394812 1321 lockfree_event.cc:164] LockfreeEvent::SetShutdown: 0x7f7668001be0 curr=0x2 err={"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} D0421 14:41:39.308404404 1321 error.cc:127] 0x2b8a660: 7 -> 8 [/tmp/pear/temp/grpc/src/core/lib/iomgr/ev_epoll1_linux.cc:388] E0421 14:41:39.308412536 1321 lockfree_event.cc:164] LockfreeEvent::SetShutdown: 0x7f7668001be8 curr=(nil) err={"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} D0421 14:41:39.308422106 1321 error.cc:175] 0x2b8a660: 8 -> 7 [/tmp/pear/temp/grpc/src/core/lib/iomgr/ev_epoll1_linux.cc:390] I0421 14:41:39.308442439 1321 combiner.cc:167] C:0x7f7668003300 grpc_combiner_execute c=0x2b899d0 last=1 D0421 14:41:39.308450976 1321 error.cc:175] 0x2b8a660: 7 -> 6 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:629] I0421 14:41:39.308458966 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1099 unref 6 -> 5 writing I0421 14:41:39.308466229 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=5 D0421 14:41:39.308481951 1321 exec_ctx.cc:34] running closure 0x7f7668003f10: created [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/subchannel.cc:317]: scheduled [/tmp/pear/temp/grpc/src/core/lib/transport/connectivity_state.cc:192] I0421 14:41:39.308490232 1321 subchannel.cc:359] Connected subchannel 0x7f7668000c00 of subchannel 0x7f7668002260 has gone into SHUTDOWN. Attempting to reconnect. D0421 14:41:39.308498220 1321 error.cc:127] 0x2b8a660: 6 -> 7 [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/subchannel.cc:370] I0421 14:41:39.308517014 1321 connectivity_state.cc:164] SET: 0x7f7668002338 subchannel: READY --> TRANSIENT_FAILURE [reflect_child] error=0x2b8a660 {"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} I0421 14:41:39.308538992 1321 connectivity_state.cc:190] NOTIFY: 0x7f7668002338 subchannel: 0x7f7668004a38 D0421 14:41:39.308547025 1321 error.cc:127] 0x2b8a660: 7 -> 8 [/tmp/pear/temp/grpc/src/core/lib/transport/connectivity_state.cc:192] D0421 14:41:39.308554347 1321 error.cc:127] 0x2b8a660: 8 -> 9 [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/subchannel.cc:374] I0421 14:41:39.308563025 1321 connectivity_state.cc:164] SET: 0x7f7668002358 subchannel: READY --> TRANSIENT_FAILURE [reflect_child] error=0x2b8a660 {"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]} D0421 14:41:39.308573343 1321 subchannel.cc:342] SUBCHANNEL: 0x7f7668002260 WEAK_UNREF 0x10003 -> 0x10002 [state_watcher] D0421 14:41:39.308580661 1321 exec_ctx.cc:43] closure 0x7f7668003f10 finished D0421 14:41:39.308587536 1321 error.cc:175] 0x2b8a660: 9 -> 8 [/tmp/pear/temp/grpc/src/core/lib/iomgr/exec_ctx.cc:46] D0421 14:41:39.308595080 1321 exec_ctx.cc:34] running closure 0x7f7668004a38: created [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/subchannel.cc:450]: scheduled [/tmp/pear/temp/grpc/src/core/lib/transport/connectivity_state.cc:192] I0421 14:41:39.308602808 1321 ev_posix.cc:381] (polling-api) pollset_set_del_pollset_set(0xdeafbeef, 0xdeafbeef) D0421 14:41:39.308610256 1321 subchannel.cc:467] SUBCHANNEL: 0x7f7668002260 WEAK_UNREF 0x10002 -> 0x10001 [external_state_watcher+done] D0421 14:41:39.308617403 1321 error.cc:127] 0x2b8a660: 8 -> 9 [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/subchannel.cc:469] I0421 14:41:39.308624445 1321 combiner.cc:167] C:0x2b896b0 grpc_combiner_execute c=0x7f76680015c0 last=1 D0421 14:41:39.308631697 1321 exec_ctx.cc:43] closure 0x7f7668004a38 finished D0421 14:41:39.308638789 1321 error.cc:175] 0x2b8a660: 9 -> 8 [/tmp/pear/temp/grpc/src/core/lib/iomgr/exec_ctx.cc:46] I0421 14:41:39.308646147 1321 combiner.cc:231] C:0x7f7668000f20 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308653248 1321 combiner.cc:254] C:0x7f7668000f20 maybe_finish_one n=0x7f7668006840 I0421 14:41:39.308660877 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:2624 unref 5 -> 4 bdp_ping I0421 14:41:39.308670347 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=3 I0421 14:41:39.308677383 1321 combiner.cc:231] C:0x7f7668003300 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308684248 1321 combiner.cc:254] C:0x7f7668003300 maybe_finish_one n=0x2b899d0 I0421 14:41:39.308691279 1321 resource_quota.cc:544] RU shutdown 0x7f76680037a0 I0421 14:41:39.308699455 1321 combiner.cc:167] C:0x7f7668000f20 grpc_combiner_execute c=0x7f7668006950 last=1 I0421 14:41:39.308706307 1321 combiner.cc:167] C:0x7f7668000f20 grpc_combiner_execute c=0x7f76680069a0 last=3 I0421 14:41:39.308714549 1321 combiner.cc:296] C:0x7f7668003300 finish old_state=3 I0421 14:41:39.308721638 1321 combiner.cc:231] C:0x2b896b0 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308728712 1321 combiner.cc:254] C:0x2b896b0 maybe_finish_one n=0x7f76680015c0 I0421 14:41:39.308739017 1321 subchannel_list.h:442] [pick_first 0x7f76680010b0] subchannel list 0x7f7668001560 index 0 of 1 (subchannel 0x7f7668002260): connectivity changed: state=TRANSIENT_FAILURE, error={"created":"@1555854099.307546922","description":"Delayed close due to in-progress write","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":587,"referenced_errors":[{"created":"@1555854099.307184724","description":"Endpoint read failed","file":"/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2500,"occurred_during_write":0,"referenced_errors":[{"created":"@1555854099.307074894","description":"Socket closed","fd":3,"file":"/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc","file_line":479,"grpc_status":14,"target_address":"ipv4:192.168.20.211:5554"}]}]}, shutting_down=0 D0421 14:41:39.308750313 1321 error.cc:127] 0x2b8a660: 8 -> 9 [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h:466] I0421 14:41:39.308765853 1321 pick_first.cc:455] Pick First 0x7f76680010b0 connectivity changed for selected subchannel I0421 14:41:39.308773541 1321 connectivity_state.cc:164] SET: 0x7f7668001118 pick_first: READY --> IDLE [selected_changed+reresolve] error=(nil) "No Error" I0421 14:41:39.308780856 1321 connectivity_state.cc:190] NOTIFY: 0x7f7668001118 pick_first: 0x7f7668000c60 I0421 14:41:39.308787975 1321 combiner.cc:167] C:0x2b896b0 grpc_combiner_execute c=0x7f7668000c60 last=3 I0421 14:41:39.308795744 1321 combiner.cc:167] C:0x2b896b0 grpc_combiner_execute c=0x7f7668001338 last=5 I0421 14:41:39.308804391 1321 lb_policy.cc:76] pick_first 0x7f76680010b0: scheduling re-resolution closure with error="No Error". I0421 14:41:39.308812329 1321 subchannel_list.h:370] [pick_first 0x7f76680010b0] subchannel list 0x7f7668001560 index 0 of 1 (subchannel 0x7f7668002260): stopping connectivity watch I0421 14:41:39.308820571 1321 ref_counted.h:139] pick_first:0x7f7668001568 /tmp/pear/temp/grpc/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h:379 unref 2 -> 1 connectivity_watch D0421 14:41:39.308828550 1321 error.cc:175] 0x2b8a660: 9 -> 8 [/tmp/pear/temp/grpc/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc:502] D0421 14:41:39.308836366 1321 error.cc:175] 0x2b8a660: 8 -> 7 [/tmp/pear/temp/grpc/src/core/lib/iomgr/combiner.cc:269] I0421 14:41:39.308843720 1321 combiner.cc:296] C:0x2b896b0 finish old_state=7 I0421 14:41:39.308850909 1321 combiner.cc:231] C:0x2b896b0 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308859510 1321 combiner.cc:254] C:0x2b896b0 maybe_finish_one n=0x7f7668000c60 I0421 14:41:39.308866652 1321 request_routing.cc:429] request_router=0x2b89508: lb_policy=0x7f76680010b0 state changed to IDLE I0421 14:41:39.308874329 1321 request_routing.cc:606] request_router=0x2b89508: setting connectivity state to IDLE I0421 14:41:39.308882521 1321 connectivity_state.cc:164] SET: 0x2b895e0 request_router: READY --> IDLE [lb_changed] error=(nil) "No Error" I0421 14:41:39.308890918 1321 connectivity_state.cc:116] CONWATCH: 0x7f7668001118 pick_first: from IDLE [cur=IDLE] notify=0x7f7668000c60 I0421 14:41:39.308898022 1321 combiner.cc:296] C:0x2b896b0 finish old_state=5 I0421 14:41:39.308905537 1321 combiner.cc:231] C:0x2b896b0 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308912598 1321 combiner.cc:254] C:0x2b896b0 maybe_finish_one n=0x7f7668001338 I0421 14:41:39.308919826 1321 request_routing.cc:488] request_router=0x2b89508: started name re-resolving D0421 14:41:39.308927348 1321 dns_resolver.cc:255] In cooldown from last resolution (from 39 ms ago). Will resolve again in 961 ms I0421 14:41:39.308935981 1321 ref_counted.h:98] resolver_refcount:0x2b89b48 /tmp/pear/temp/grpc/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc:264 ref 1 -> 2 next_resolution_timer_cooldown I0421 14:41:39.308945248 1321 timer_generic.cc:365] TIMER 0x2b89bf8: SET 961 now 44 call 0x2b89c30[0x7f766eb842c0] I0421 14:41:39.308952971 1321 timer_generic.cc:401] .. add to shard 0 with queue_deadline_cap=1001 => is_first_timer=true I0421 14:41:39.308961158 1321 timer_generic.cc:423] .. old shard min_deadline=1002 I0421 14:41:39.308968382 1321 combiner.cc:296] C:0x2b896b0 finish old_state=3 I0421 14:41:39.308976605 1321 combiner.cc:231] C:0x7f7668000f20 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.308983950 1321 combiner.cc:254] C:0x7f7668000f20 maybe_finish_one n=0x7f7668006950 I0421 14:41:39.308993231 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:3072 unref 4 -> 3 benign_reclaimer I0421 14:41:39.309001756 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=5 I0421 14:41:39.309009029 1321 combiner.cc:231] C:0x7f7668000f20 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.309016290 1321 combiner.cc:254] C:0x7f7668000f20 maybe_finish_one n=0x7f76680069a0 I0421 14:41:39.309024078 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:3103 unref 3 -> 2 destructive_reclaimer I0421 14:41:39.309032311 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=3 I0421 14:41:39.309039183 1321 ev_epoll1_linux.cc:990] .. remove worker I0421 14:41:39.309046461 1321 ev_posix.cc:323] (polling-api) pollset_work(0x2b85880, 9223372036854775807) end D0421 14:41:39.309054102 1321 transport.cc:59] CALL_STACK 0x2b9d9a0:0x2b9cfa0 UNREF 2->1 completion I0421 14:41:39.309062209 1321 completion_queue.cc:1295] RETURN_EVENT[0x2b85740]: OP_COMPLETE: tag:0x2b9cfa0 OK D0421 14:41:39.309070351 1321 completion_queue.cc:1296] CQ:0x2b85740 unref 4 -> 3 pluck I0421 14:41:39.309081223 1321 metadata_array.cc:34] grpc_metadata_array_destroy(array=0x7ffd8faa82f0) I0421 14:41:39.309088709 1321 metadata_array.cc:34] grpc_metadata_array_destroy(array=0x7ffd8faa8310) I0421 14:41:39.309095533 1321 metadata_array.cc:34] grpc_metadata_array_destroy(array=0x7ffd8faa8330) I0421 14:41:39.309102250 1321 metadata_array.cc:34] grpc_metadata_array_destroy(array=0x7ffd8faa8350) I0421 14:41:39.309113576 1321 call.cc:562] grpc_call_unref(c=0x2b9cfa0) I0421 14:41:39.309122525 1321 call_combiner.cc:215] call_combiner=0x2b9cfb0: setting notify_on_cancel=(nil) D0421 14:41:39.309130167 1321 transport.cc:59] CALL_STACK 0x2b9d9a0:0x2b9cfa0 UNREF 1->0 destroy D0421 14:41:39.309138867 1321 exec_ctx.cc:34] running closure 0x2b9d9a8: created [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:131]: scheduled [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:80] D0421 14:41:39.309147505 1321 call.cc:534] CQ:0x2b85740 unref 3 -> 2 bind D0421 14:41:39.309154996 1321 error.cc:175] 0x2b8ade0: 1 -> 0 [/tmp/pear/temp/grpc/src/core/lib/surface/call.cc:542] D0421 14:41:39.309164599 1321 transport.cc:59] CALL_STACK 0x2b9e240:0x2b9e1c0 UNREF 1->0 D0421 14:41:39.309172860 1321 exec_ctx.cc:43] closure 0x2b9d9a8 finished D0421 14:41:39.309180182 1321 exec_ctx.cc:34] running closure 0x2b9e248: created [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:131]: scheduled [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:80] I0421 14:41:39.309188932 1321 combiner.cc:167] C:0x7f7668000f20 grpc_combiner_execute c=0x2b9efe8 last=1 D0421 14:41:39.309197371 1321 transport.cc:59] CLIENT_SUBCHANNEL 0x7f7668003b10:0x7f7668003b10 UNREF 1->0 connected_subchannel_dtor D0421 14:41:39.309205678 1321 exec_ctx.cc:43] closure 0x2b9e248 finished D0421 14:41:39.309212951 1321 exec_ctx.cc:34] running closure 0x7f7668003b18: created [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:131]: scheduled [/tmp/pear/temp/grpc/src/core/lib/transport/transport.cc:80] D0421 14:41:39.309221148 1321 client_authority_filter.cc:116] ELM UNREF:0x7f7668003c70:2->1: ':authority' = '192.168.20.211:5554' D0421 14:41:39.309230359 1321 http_client_filter.cc:584] ELM UNREF:0x7f7668003df0:2->1: 'user-agent' = 'grpc-c/7.0.0 (linux; chttp2; gold)' I0421 14:41:39.309238105 1321 combiner.cc:167] C:0x7f7668000f20 grpc_combiner_execute c=0x2b8a530 last=3 D0421 14:41:39.309245500 1321 exec_ctx.cc:43] closure 0x7f7668003b18 finished I0421 14:41:39.309252745 1321 combiner.cc:231] C:0x7f7668000f20 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.309261348 1321 combiner.cc:254] C:0x7f7668000f20 maybe_finish_one n=0x2b9efe8 D0421 14:41:39.309268943 1321 error.cc:175] 0x2b8b9e0: 2 -> 1 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:723] I0421 14:41:39.309277016 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:733 unref 2 -> 1 stream I0421 14:41:39.309284499 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=5 D0421 14:41:39.309292056 1321 exec_ctx.cc:34] running closure 0x2b9d920: created [/tmp/pear/temp/grpc/src/core/lib/surface/call.cc:548]: scheduled [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:734] D0421 14:41:39.309302088 1321 transport.cc:59] CLIENT_CHANNEL 0x2b89478:0x2b89410 UNREF 5->4 call D0421 14:41:39.309310277 1321 exec_ctx.cc:43] closure 0x2b9d920 finished I0421 14:41:39.309317464 1321 combiner.cc:231] C:0x7f7668000f20 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.309325506 1321 combiner.cc:254] C:0x7f7668000f20 maybe_finish_one n=0x2b8a530 D0421 14:41:39.309333046 1321 error.cc:337] 0x2b8fdf0 create [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:561] D0421 14:41:39.309342045 1321 error.cc:127] 0x2b8fdf0: 1 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:576] D0421 14:41:39.309349820 1321 error.cc:175] 0x2b8fdf0: 2 -> 1 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:2417] D0421 14:41:39.309357365 1321 error.cc:127] 0x2b8fdf0: 1 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:577] D0421 14:41:39.309364833 1321 error.cc:127] 0x2b8fdf0: 2 -> 3 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309372117 1321 error.cc:175] 0x2b8fdf0: 3 -> 2 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309379714 1321 error.cc:127] 0x2b8fdf0: 2 -> 3 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309387043 1321 error.cc:175] 0x2b8fdf0: 3 -> 2 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309394445 1321 error.cc:127] 0x2b8fdf0: 2 -> 3 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309401709 1321 error.cc:175] 0x2b8fdf0: 3 -> 2 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309409005 1321 error.cc:175] 0x2b8fdf0: 2 -> 1 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1710] D0421 14:41:39.309416459 1321 error.cc:175] 0x2b8fdf0: 1 -> 0 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:629] I0421 14:41:39.309424353 1321 ref_counted.h:139] chttp2_refcount:0x7f7668005008 /tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:564 unref 1 -> 0 destroy D0421 14:41:39.309433219 1321 tcp_posix.cc:402] TCP unref 0x7f76680033f0 : destroy 1 -> 0 I0421 14:41:39.309440686 1321 ev_posix.cc:265] (polling-api) fd_orphan(3, (nil), (nil), tcp_unref_orphan) I0421 14:41:39.309447600 1321 ev_posix.cc:266] (fd-trace) grpc_fd_orphan, fd:3 closed D0421 14:41:39.309463319 1321 error.cc:175] 0x2b8a660: 7 -> 6 [/tmp/pear/temp/grpc/src/core/lib/iomgr/lockfree_event.cc:79] D0421 14:41:39.309472858 1321 error.cc:175] 0x2b8a660: 6 -> 5 [/tmp/pear/temp/grpc/src/core/lib/iomgr/lockfree_event.cc:79] D0421 14:41:39.309480206 1321 error.cc:175] 0x2b8a660: 5 -> 4 [/tmp/pear/temp/grpc/src/core/lib/iomgr/lockfree_event.cc:79] I0421 14:41:39.309487633 1321 combiner.cc:167] C:0x7f7668003300 grpc_combiner_execute c=0x7f7668003978 last=1 D0421 14:41:39.309496202 1321 error.cc:337] 0x2b8fdf0 create [/tmp/pear/temp/grpc/src/core/lib/iomgr/tcp_posix.cc:350] D0421 14:41:39.309503878 1321 error.cc:175] 0x2b8fdf0: 1 -> 0 [/tmp/pear/temp/grpc/src/core/lib/iomgr/buffer_list.h:152] D0421 14:41:39.309512868 1321 hpack_encoder.cc:612] ELM UNREF:0x7f7668003df0:1->0: 'user-agent' = 'grpc-c/7.0.0 (linux; chttp2; gold)' D0421 14:41:39.309521476 1321 hpack_encoder.cc:612] ELM UNREF:0x7f7668003c70:1->0: ':authority' = '192.168.20.211:5554' D0421 14:41:39.309529415 1321 error.cc:337] 0x2b8fdf0 create [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:175] D0421 14:41:39.309538158 1321 error.cc:175] 0x2b8fdf0: 1 -> 0 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:179] D0421 14:41:39.309546169 1321 hpack_table.cc:196] ELM UNREF:0x7f76680048b0:1->0: 'grpc-message' = '' D0421 14:41:39.309555743 1321 error.cc:175] 0x2b8a660: 4 -> 3 [/tmp/pear/temp/grpc/src/core/lib/transport/connectivity_state.cc:72] D0421 14:41:39.309564113 1321 chttp2_transport.cc:198] C:0x7f7668000f20 UNREF 1 --> 0 chttp2_transport I0421 14:41:39.309571264 1321 combiner.cc:103] C:0x7f7668000f20 really_destroy old_state=3 D0421 14:41:39.309579633 1321 error.cc:337] 0x2b90f00 create [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:201] D0421 14:41:39.309587524 1321 error.cc:127] 0x2b90f00: 1 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309594933 1321 error.cc:175] 0x2b90f00: 2 -> 1 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309602435 1321 error.cc:127] 0x2b90f00: 1 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309609772 1321 error.cc:175] 0x2b90f00: 2 -> 1 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309617273 1321 error.cc:127] 0x2b90f00: 1 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1707] D0421 14:41:39.309624731 1321 error.cc:175] 0x2b90f00: 2 -> 1 [/tmp/pear/temp/grpc/src/core/lib/iomgr/closure.h:222] D0421 14:41:39.309632026 1321 error.cc:175] 0x2b90f00: 1 -> 0 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:1710] D0421 14:41:39.309640946 1321 error.cc:175] 0x2b8a660: 3 -> 2 [/tmp/pear/temp/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc:211] I0421 14:41:39.309648774 1321 combiner.cc:296] C:0x7f7668000f20 finish old_state=2 I0421 14:41:39.309655775 1321 combiner.cc:94] C:0x7f7668000f20 really_destroy I0421 14:41:39.309663228 1321 combiner.cc:231] C:0x7f7668003300 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=0 I0421 14:41:39.309670350 1321 combiner.cc:254] C:0x7f7668003300 maybe_finish_one n=0x7f7668003978 I0421 14:41:39.309678217 1321 combiner.cc:340] C:0x7f7668003300 grpc_combiner_execute_finally c=0x7f7668003220; ac=0x7f7668003300 I0421 14:41:39.309685587 1321 combiner.cc:296] C:0x7f7668003300 finish old_state=5 I0421 14:41:39.309692734 1321 combiner.cc:231] C:0x7f7668003300 grpc_combiner_continue_exec_ctx contended=0 exec_ctx_ready_to_finish=1 time_to_execute_final_list=1 I0421 14:41:39.309700872 1321 combiner.cc:278] C:0x7f7668003300 execute_final[0] c=0x7f7668003220 D0421 14:41:39.309708252 1321 resource_quota.cc:666] C:0x7f7668003300 UNREF 1 --> 0 resource_quota I0421 14:41:39.309715385 1321 combiner.cc:103] C:0x7f7668003300 really_destroy old_state=3 I0421 14:41:39.309722329 1321 combiner.cc:296] C:0x7f7668003300 finish old_state=2 I0421 14:41:39.309729147 1321 combiner.cc:94] C:0x7f7668003300 really_destroy </code></pre> <p>Version information:</p> <pre><code>PHP: 7.0.6 / 7.3.4 grpc php extension: 1.19.0 protobuf php version: 3.7.1 golang grpc version: google.golang.org/grpc v1.19.0 </code></pre> </div>
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页