brpc icon indicating copy to clipboard operation
brpc copied to clipboard

DynamicPartitionChannel thrift协议使用backup request产生coredump

Open a1368017681 opened this issue 2 years ago • 2 comments

Describe the bug (描述bug) 使用DynamicPartitionChannel thrift协议访问下游时偶发coredump,下游分库数量>=1都会出现该问题,coredump位置在selective_channel.cpp:375, image 定位发现thrift_message的包装未实现反射 image GetReflection拿到空指针调用Swap产生了core。 main_cntl->_response->GetReflection()->Swap(main_cntl->_response, _cntl._response) 语义看起来是要Swap两个res,于是尝试强转手动调用了ThriftMessage的Swap方法: auto thrift_res = static_cast<ThriftFramedMessage*>(main_cntl->_response); thrift_res->Swap(static_cast<ThriftFramedMessage*>(_cntl._response)); 修改完毕之后压测会继续偶发core在 thrift_message.h:192行,似乎response有点问题。 image 尝试定位修改了一些代码,可能跟backup request cancel行为有关。

To Reproduce (复现方法) DynamicPartitionChannel thrift协议访问下游开启backup request,max_retry=1,timeout=800ms,backup定时器可以调小来增加触发概率。

Expected behavior (期望行为) 1.期望解释一下main_cntl->_response->GetReflection()->Swap(main_cntl->_response, _cntl._response)场景含义,看了channel一些代码,感觉写的有点绕。 2.修正DynamicPartitionChannel backup request行为。

Versions (各种版本) OS: centos6 Compiler: gcc492 brpc: tag:1.2.0 protobuf: 3.8

Additional context/screenshots (更多上下文/截图)

a1368017681 avatar Nov 23 '23 06:11 a1368017681

@jamesge 戈神 有时间帮忙看看这段代码的问题

Huixxi avatar Nov 25 '23 11:11 Huixxi

@jamesge 戈神 有时间帮忙看看这段代码的问题

大神有啥消息不~,或者这个场景的含义先帮解释下?

a1368017681 avatar Dec 01 '23 08:12 a1368017681