zzjshaok opened a new issue #992: ParallelChannel发送消息偶尔失败
URL: https://github.com/apache/incubator-brpc/issues/992
 
 
   brpc::ParallelChannel 对象内部只AddChannel了一个sub channel,进行rpc 
客户端调用时,有时候会报错,业务代码如下:
   stub.rnd_next(&(m_readrpcDone->cntl), &request, 
&(m_readrpcDone->read_response), m_readrpcDone);
   if (m_readrpcDone->cntl.Failed())
    {
           MLOG_ERROR("errcode %d, errmsg %s,remote_side %s, local_side %s", 
m_readrpcDone->cntl.ErrorCode(), m_readrpcDone->cntl.ErrorText().c_str(), 
butil::endpoint2str(m_readrpcDone->cntl.remote_side()).c_str(),butil::endpoint2str(m_readrpcDone->cntl.local_side()).c_str());
           return m_readrpcDone->cntl.ErrorCode();
     }
   
   调用失败时,会进入m_readrpcDone->cntl.Failed()内部,此时打印相关信息如下:
   (gdb) p m_readrpcDone->cntl
   $1 = {<google::protobuf::RpcController> = {_vptr.RpcController = 
0x7f5212d22df0 <vtable for brpc::Controller+16>}, 
     static FLAGS_IGNORE_EOVERCROWDED = 1, static FLAGS_SECURITY_MODE = 2, 
static FLAGS_ADDED_CONCURRENCY = 4, 
     static FLAGS_READ_PROGRESSIVELY = 8, static FLAGS_PROGRESSIVE_READER = 16, 
static FLAGS_BACKUP_REQUEST = 32, 
     static FLAGS_DESTROY_CID_IN_DONE = 128, static FLAGS_CLOSE_CONNECTION = 
256, static FLAGS_LOG_ID = 512, 
     static FLAGS_REQUEST_CODE = 1024, static FLAGS_PB_BYTES_TO_BASE64 = 2048, 
static FLAGS_ALLOW_DONE_TO_RUN_IN_PLACE = 4096, 
     static FLAGS_USED_BY_RPC = 8192, static FLAGS_REQUEST_WITH_AUTH = 32768, 
static FLAGS_PB_JSONIFY_EMPTY_ARRAY = 65536, 
     static FLAGS_ENABLED_CIRCUIT_BREAKER = 131072, static 
FLAGS_ALWAYS_PRINT_PRIMITIVE_FIELDS = 262144, _span = 0x0, _flags = 10368, 
     _error_code = 1008, _error_text = {static npos = 18446744073709551615, 
       _M_dataplus = {<std::allocator<char>> = 
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
         _M_p = 0x7f51b9259f60 
"[E1008][HandleSocketFailed@/data01/zhangzj/mdb_4.0/mariadb-10.4.8/storage/mdb/src/3rd/brpc/src/brpc/controller.cpp:1194]Reached
 timeout=50000ms @0.0.0.0:0"}, _M_string_length = 154, {
         _M_local_buf = "\234\000\000\000\000\000\000\000Handle\000", 
_M_allocated_capacity = 156}}, _remote_side = {ip = {s_addr = 0}, 
       port = 0}, _local_side = {ip = {s_addr = 0}, port = 0}, 
_session_local_data = 0x0, _server = 0x0, _oncancel_id = {value = 0}, 
     _auth_context = 0x0, _mongo_session_data = {px = 0x0}, _rpc_dump_meta = 
0x0, _request_protocol = brpc::PROTOCOL_UNKNOWN, 
     _max_retry = -123456789, _retry_policy = 0x0, _correlation_id = {value = 
7696581394433}, 
     _connection_type = brpc::CONNECTION_TYPE_UNKNOWN, _fail_limit = 
-123456789, _pipelined_count = 0, _timeout_ms = 50000, 
     _connect_timeout_ms = -123456789, _backup_request_ms = -123456789, 
_deadline_us = 1576054482870493, _timeout_id = 0, 
     _begin_time_us = 1576054432870493, _end_time_us = 1576054482871014, _tos = 
0, _preferred_index = -1, 
     _request_compress_type = brpc::COMPRESS_TYPE_NONE, _response_compress_type 
= brpc::COMPRESS_TYPE_NONE, _log_id = 0, 
     _pchan_sub_count = 1, _response = 0x7f5178c64f48, _done = 0x7f5175355a80, 
_sender = 0x0, _request_code = 0, 
     _single_server_id = 18446744073709551615, _lb = {px = 0x0}, 
_tmp_completion_info = {id = {value = 7696581394433}, 
       responded = false}, _current_call = {nretry = 0, need_feedback = false, 
enable_circuit_breaker = false, 
       touched_by_stream_creator = false, peer_id = 18446744073709551615, 
begin_time_us = 0, sending_sock = {
         _M_t = {<std::_Tuple_impl<0ul, brpc::Socket*, brpc::SocketDeleter>> = 
{<std::_Tuple_impl<1ul, brpc::SocketDeleter>> = {<std::_Head_base<1ul, 
brpc::SocketDeleter, true>> = {<brpc::SocketDeleter> = {<No data fields>}, <No 
data fields>}, <No data fields>}, <std::_Head_base<0ul, brpc::Socket*, false>> 
= {_M_head_impl = 0x0}, <No data fields>}, <No data fields>}}, stream_user_data 
= 0x0}, 
     _unfinished_call = 0x0, _accessed = 0x0, _stream_creator = 0x0, 
_pack_request = 0x0, _method = 0x0, _auth = 0x0, _request_buf = {
       static DEFAULT_BLOCK_SIZE = 8192, static INITIAL_CAP = 32, static 
INVALID_AREA = 0, {_bv = {magic = 0, start = 0, refs = 0x0, 
           nref = 0, cap_mask = 0, nbytes = 0}, _sv = {refs = {{offset = 0, 
length = 0, block = 0x0}, {offset = 0, length = 0, 
               block = 0x0}}}}}, _idl_names = {request_name = 0x7f5212716d6b 
"req", response_name = 0x7f521272da73 "res"}, 
   ---Type <return> to continue, or q <return> to quit---
     _idl_result = 12345678987654321, _http_request = 0x0, _http_response = 
0x0, _request_attachment = {
       static DEFAULT_BLOCK_SIZE = 8192, static INITIAL_CAP = 32, static 
INVALID_AREA = 0, {_bv = {magic = 0, start = 0, refs = 0x0, 
           nref = 0, cap_mask = 0, nbytes = 0}, _sv = {refs = {{offset = 0, 
length = 0, block = 0x0}, {offset = 0, length = 0, 
               block = 0x0}}}}}, _response_attachment = {static 
DEFAULT_BLOCK_SIZE = 8192, static INITIAL_CAP = 32, 
       static INVALID_AREA = 0, {_bv = {magic = 0, start = 0, refs = 0x0, nref 
= 0, cap_mask = 0, nbytes = 0}, _sv = {refs = {{
               offset = 0, length = 0, block = 0x0}, {offset = 0, length = 0, 
block = 0x0}}}}}, _wpa = {px = 0x0}, _rpa = {px = 0x0}, 
     _request_stream = 18446744073709551615, _response_stream = 
18446744073709551615, _remote_stream_settings = 0x0, 
     _thrift_method_name = {static npos = 18446744073709551615, 
       _M_dataplus = {<std::allocator<char>> = 
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
         _M_p = 0x7f5178c651b8 ""}, _M_string_length = 0, {_M_local_buf = 
'\000' <repeats 15 times>, _M_allocated_capacity = 0}}}
   (gdb) 
   (gdb) 
   (gdb) p m_readrpcDone->cntl._pchan_sub_count
   $2 = 1
   (gdb) p m_readrpcDone->cntl.sub(0)
   $3 = (const brpc::Controller *) 0x7f5175355af8
   (gdb) p *(const brpc::Controller *) 0x7f5175355af8
   $4 = {<google::protobuf::RpcController> = {_vptr.RpcController = 
0x7f5212d22df0 <vtable for brpc::Controller+16>}, 
     static FLAGS_IGNORE_EOVERCROWDED = 1, static FLAGS_SECURITY_MODE = 2, 
static FLAGS_ADDED_CONCURRENCY = 4, 
     static FLAGS_READ_PROGRESSIVELY = 8, static FLAGS_PROGRESSIVE_READER = 16, 
static FLAGS_BACKUP_REQUEST = 32, 
     static FLAGS_DESTROY_CID_IN_DONE = 128, static FLAGS_CLOSE_CONNECTION = 
256, static FLAGS_LOG_ID = 512, 
     static FLAGS_REQUEST_CODE = 1024, static FLAGS_PB_BYTES_TO_BASE64 = 2048, 
static FLAGS_ALLOW_DONE_TO_RUN_IN_PLACE = 4096, 
     static FLAGS_USED_BY_RPC = 8192, static FLAGS_REQUEST_WITH_AUTH = 32768, 
static FLAGS_PB_JSONIFY_EMPTY_ARRAY = 65536, 
     static FLAGS_ENABLED_CIRCUIT_BREAKER = 131072, static 
FLAGS_ALWAYS_PRINT_PRIMITIVE_FIELDS = 262144, _span = 0x0, _flags = 14848, 
     _error_code = 125, _error_text = {static npos = 18446744073709551615, 
       _M_dataplus = {<std::allocator<char>> = 
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
         _M_p = 0x7f51cc13ccc0 
"[E125][HandleSocketFailed@/data01/zhangzj/mdb_4.0/mariadb-10.4.8/storage/mdb/src/3rd/brpc/src/brpc/controller.cpp:1203]Operation
 canceled @10.19.18.65:11010"}, _M_string_length = 156, {
         _M_local_buf = "\235\000\000\000\000\000\000\000andleS\000", 
_M_allocated_capacity = 157}}, _remote_side = {ip = {
         s_addr = 1091703562}, port = 11010}, _local_side = {ip = {s_addr = 
1173422346}, port = 49613}, _session_local_data = 0x0, 
     _server = 0x0, _oncancel_id = {value = 0}, _auth_context = 0x0, 
_mongo_session_data = {px = 0x0}, _rpc_dump_meta = 0x0, 
     _request_protocol = brpc::PROTOCOL_BAIDU_STD, _max_retry = 3, 
_retry_policy = 0x0, _correlation_id = {value = 7700876361729}, 
     _connection_type = brpc::CONNECTION_TYPE_SINGLE, _fail_limit = -123456789, 
_pipelined_count = 0, _timeout_ms = -1, 
     _connect_timeout_ms = 200, _backup_request_ms = -1, _deadline_us = -1, 
_timeout_id = 0, _begin_time_us = 1576054432870596, 
     _end_time_us = 1576054482871001, _tos = 0, _preferred_index = 1, 
_request_compress_type = brpc::COMPRESS_TYPE_NONE, 
     _response_compress_type = brpc::COMPRESS_TYPE_NONE, _log_id = 0, 
_pchan_sub_count = 0, _response = 0x7f51740814b0, 
     _done = 0x7f5175355ac0, _sender = 0x0, _request_code = 0, 
_single_server_id = 384, _lb = {px = 0x0}, _tmp_completion_info = {id = {
         value = 7700876361729}, responded = false}, _current_call = {nretry = 
0, need_feedback = false, enable_circuit_breaker = false, 
       touched_by_stream_creator = false, peer_id = 384, begin_time_us = 
1576054432870596, sending_sock = {
         _M_t = {<std::_Tuple_impl<0ul, brpc::Socket*, brpc::SocketDeleter>> = 
{<std::_Tuple_impl<1ul, brpc::SocketDeleter>> = {<std::_Head_base<1ul, 
brpc::SocketDeleter, true>> = {<brpc::SocketDeleter> = {<No data fields>}, <No 
data fields>}, <No data fields>}, <std::_Head_base<0ul, brpc::Socket*, false>> 
= {_M_head_impl = 0x0}, <No data fields>}, <No data fields>}}, stream_user_data 
= 0x0}, 
     _unfinished_call = 0x0, _accessed = 0x0, _stream_creator = 0x0, 
_pack_request = 0x7f521226cd70
        <brpc::policy::PackRpcRequest(butil::IOBuf*, brpc::SocketMessage**, 
unsigned long, google::protobuf::MethodDescriptor const*, brpc::Controller*, 
butil::IOBuf const&, brpc::Authenticator const*)>, _method = 0x7f51f8712dd0, 
_auth = 0x0, _request_buf = {
       static DEFAULT_BLOCK_SIZE = 8192, static INITIAL_CAP = 32, static 
INVALID_AREA = 0, {_bv = {magic = 0, start = 24, 
           refs = 0x7f517536d640, nref = 0, cap_mask = 0, nbytes = 0}, _sv = 
{refs = {{offset = 0, length = 24, block = 0x7f517536d640}, 
   ---Type <return> to continue, or q <return> to quit---
             {offset = 0, length = 0, block = 0x0}}}}}, _idl_names = 
{request_name = 0x7f5212716d6b "req", 
       response_name = 0x7f521272da73 "res"}, _idl_result = 12345678987654321, 
_http_request = 0x0, _http_response = 0x0, 
     _request_attachment = {static DEFAULT_BLOCK_SIZE = 8192, static 
INITIAL_CAP = 32, static INVALID_AREA = 0, {_bv = {magic = 0, 
           start = 0, refs = 0x0, nref = 0, cap_mask = 0, nbytes = 0}, _sv = 
{refs = {{offset = 0, length = 0, block = 0x0}, {
               offset = 0, length = 0, block = 0x0}}}}}, _response_attachment = 
{static DEFAULT_BLOCK_SIZE = 8192, 
       static INITIAL_CAP = 32, static INVALID_AREA = 0, {_bv = {magic = 0, 
start = 0, refs = 0x0, nref = 0, cap_mask = 0, nbytes = 0}, 
         _sv = {refs = {{offset = 0, length = 0, block = 0x0}, {offset = 0, 
length = 0, block = 0x0}}}}}, _wpa = {px = 0x0}, _rpa = {
       px = 0x0}, _request_stream = 18446744073709551615, _response_stream = 
18446744073709551615, _remote_stream_settings = 0x0, 
     _thrift_method_name = {static npos = 18446744073709551615, 
       _M_dataplus = {<std::allocator<char>> = 
{<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
         _M_p = 0x7f5175355d38 ""}, _M_string_length = 0, {_M_local_buf = 
'\000' <repeats 15 times>, _M_allocated_capacity = 0}}}
   (gdb) 
   
   失败时,服务端和客户端完全没压力,对于[E1008][HandleSocketFailed 和 [E125][HandleSocketFailed, 
需要从哪个方向定位问题?rpc客户端发消息发送不出去?为啥发不出去?
   
   此时在客户端的机器上敲命令 curl 10.19.18.65:11010/health,往rpc服务端发消息,会收到OK
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to