Skip to content

crash at SerializedRequest #2961

@gulu-goolu

Description

@gulu-goolu

Describe the bug
SerializedRequest doesn't provide a valid GetClassData method.

Image

To Reproduce

for (brpc::SampledRequest *sample = get_next_sample(); !brpc::IsAskedToQuit() && sample != NULL;
         sample = get_next_sample(), ++j) {
    brpc::SerializedRequest req;
    req.serialized_data() = sample->request.movable();
    chan->CallMethod(NULL /*use rpc_dump_context in cntl instead*/, cntl, &req,
                     NULL /*ignore response*/, NULL);
}

Expected behavior

Versions
OS: ubuntu20.04
Compiler: clang-14
brpc: 1.12.1
protobuf: 27.3

Additional context/screenshots

I0429 13:04:00.354708 243809     0 tools/subcommands/replay_command.cc:170] max_protocol_size: 26
Process 243809 stopped
* thread #9, name = 'brpc_wkr:0-5', stop reason = signal SIGSEGV: invalid address (fault address: 0x1c)
    frame #0: 0x00005555570db784 rtp_test_tool`google::protobuf::MessageLite::ClassData::full(this=0x0000000000000000) const at message_lite.h:585:7
(lldb) bt
* thread #9, name = 'brpc_wkr:0-5', stop reason = signal SIGSEGV: invalid address (fault address: 0x1c)
  * frame #0: 0x00005555570db784 rtp_test_tool`google::protobuf::MessageLite::ClassData::full(this=0x0000000000000000) const at message_lite.h:585:7
    frame #1: 0x0000555559031491 rtp_test_tool`google::protobuf::Message::GetMetadata(this=0x00007fffdd2f2e48) const at message.cc:140:42
    frame #2: 0x0000555558578065 rtp_test_tool`google::protobuf::Message::GetDescriptor(this=0x00007fffdd2f2e48) const at message.h:359:52
    frame #3: 0x000055555868f694 rtp_test_tool`brpc::SerializeRequestDefault(buf=0x00007fffcc025750, cntl=0x00007fffcc0255a0, request=0x00007fffdd2f2e48) at protocol.cpp:140:18
    frame #4: 0x00005555584fded2 rtp_test_tool`brpc::Channel::CallMethod(this=0x000055555a48e470, method=0x0000000000000000, controller_base=0x00007fffcc0255a0, request=0x00007fffdd2f2e48, response=0x0000000000000000, done=0x00007fffcc0239f0) at channel.cpp:524:5
    frame #5: 0x0000555557090284 rtp_test_tool`rtp_hpa::replay_command::replay_thread(arg=0x00007fffffffdae0) at replay_command.cc:311:15
    frame #6: 0x00005555587f057e rtp_test_tool`bthread::TaskGroup::task_runner(skip_remained=0) at task_group.cpp:305:29
    frame #7: 0x00005555588001d1 rtp_test_tool`bthread_make_fcontext + 33
(lldb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions