Thrift第七课 服务器多线程发送异常
场景
C++服务器端为每一个客户端建立多线程发送,没有添加锁,会触发异常:received invalid message type 3 from client。导致服务器端主动断开跟客户端的连接
打印出错的代码在TDispatchProcessor.h文件
相关堆栈代码:
apache::thrift::TOutput::errorTimeWrapper(const char * msg) 行 134C++
apache::thrift::TOutput::printf(const char * message, ...) 行 42C++
apache::thrift::TDispatchProcessor::process(boost::shared_ptr<apache::thrift::protocol::TProtocol> in,boost::shared_ptr<apache::thrift::protocol::TProtocol> out, void * connectionContext) 行 116C++
结论
调用发送的接口最好加锁,或者是单线程发送
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。