Describe the bug (描述bug)
函数 WriteThriftMessageBegin
https://github.com/brpc/brpc/blob/master/src/brpc/policy/thrift_protocol.cpp#L118
填写 seq_id 的时候没有把指针转成 uint32_t *,导致 seq_id 不正确,java client 会报错:out of sequence response
To Reproduce (复现方法)
thrift server 不使用 ThriftFramedMessage 里的 _raw_instance(即不使用 Cast 函数),直接使用 butil::IOBuf body 时,能走到 WriteThriftMessageBegin 里。
Expected behavior (期望行为)
Versions (各种版本)
OS:
Compiler:
brpc:
protobuf:
Additional context/screenshots (更多上下文/截图)
static void
WriteThriftMessageBegin(char* buf,
const std::string& method_name,
::apache::thrift::protocol::TMessageType mtype,
uint32_t seq_id) {
char* p = buf;
*(uint32_t*)p = htonl(THRIFT_HEAD_VERSION_1 | (((uint32_t)mtype) & 0x000000FF));
p += 4;
*(uint32_t*)p = htonl(method_name.size());
p += 4;
memcpy(p, method_name.data(), method_name.size());
p += method_name.size();
*p = htonl(seq_id); // !!! 这里
}
Describe the bug (描述bug)
函数 WriteThriftMessageBegin
https://github.com/brpc/brpc/blob/master/src/brpc/policy/thrift_protocol.cpp#L118
填写 seq_id 的时候没有把指针转成 uint32_t *,导致 seq_id 不正确,java client 会报错:out of sequence response
To Reproduce (复现方法)
thrift server 不使用 ThriftFramedMessage 里的 _raw_instance(即不使用 Cast 函数),直接使用 butil::IOBuf body 时,能走到 WriteThriftMessageBegin 里。
Expected behavior (期望行为)
Versions (各种版本)
OS:
Compiler:
brpc:
protobuf:
Additional context/screenshots (更多上下文/截图)