You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2019/07/30 02:41:21 UTC

[GitHub] [incubator-brpc] zhangwei17 opened a new issue #862: 使用ip:port字符串的channel出现地址混乱的情况

zhangwei17 opened a new issue #862: 使用ip:port字符串的channel出现地址混乱的情况
URL: https://github.com/apache/incubator-brpc/issues/862
 
 
   **Describe the bug (描述bug)**
   当前我的一个服务即属于服务端,也属于客户端,有需要请求的下游。服务端监听的端口为33001,请求的下游的端口为33002,是在栈上使用channel。当服务压力较大的时候会出现地址混乱无法连接下游的情况:在日志中会打印类似如下信息的日志
   ```
   2019-07-30T10:02:54,471.421 ERROR xxxx Fail to send thrift request, [E110]Fail to connect Socket{id=326417633629 addr=10.132.93.80:33002:33001} (0x0x183ce9a00): Connection timed out [R1][E112]Not connected to 10.132.93.80:33002 yet, server_id=197568615140 [R2][E112]Not connected to 10.132.93.80:33002 yet, server_id=197568615140 - xxxx.cpp:76#void xx::xxxxxxx::OnRPCDone<T>::Run() [with T = xx::BrpcXxxRequest] - 18164@xxxx.xxx.xx.xxx
   ```
   
   请求下游地方的代码大致如下:
   ```
     brpc::Channel channel;                                                                                                                                                                      
     brpc::ChannelOptions options;
     options.protocol = brpc::PROTOCOL_THRIFT;
     options.connection_type = "pooled";
     options.timeout_ms = 1000;
     options.max_retry = 1;
     //这里的node_data是传入函数的形式为ip:port的下游主机串。
     //由于选择机器是预先做的工作,这里就用的ip:port参数的channel初始化,channel也就在栈上使用了
     if (channel.Init(node_data.c_str(), "", &options) != 0) {
       XLOG_ERROR("Fail to initialize channel");
       return 0;  
     }   
   
     brpc::ThriftStub stub(&channel);
     Response req;
     req.__set_data(data);
   
     OnRPCDone<Response> *done = new OnRPCDone<Response>();
   
     stub.CallMethod<Request, Response>((const char*)"SendBatchCandidates", &done->cntl, &resp, &done->resp, done);
   
   ```
   
   有怀疑过传入的node_data是否有问题,但是打印相关日志并未发现异常。所以想知道官方有没有碰到过这样的case,或者有没有思路可以考虑一下。
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org