Scenes
The C++ server side establishes multi-threaded sending for each client, without adding a lock, an exception will be triggered: received invalid message type 3 from client. Causes the server to actively disconnect from the client
The code that prints the error is in the TDispatchProcessor.h file
Relevant stack code:
apache::thrift::TOutput::errorTimeWrapper(const char * msg) 行 134 C++
apache::thrift::TOutput::printf(const char * message, ...) 行 42 C++
apache::thrift::TDispatchProcessor::process(boost::shared_ptr<apache::thrift::protocol::TProtocol> in,boost::shared_ptr<apache::thrift::protocol::TProtocol> out, void * connectionContext) 行 116 C++
in conclusion
It is best to lock the interface that calls the send, or send it in a single thread