builtin service执行过程中coredump

Open
#3,239 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp
Domain
api, backend

Research direction

Start with src/brpc/builtin/sockets_service.cpp, then trace the DebugSocket call in src/brpc/socket.cpp through versioned_ref_with_id.h. Reproduce the builtin service request using the reported brpc 1.11.0 environment and determine why socket dereferencing reaches the fatal log. Done means the reported builtin service request no longer coredumps.

Written by the indexing model from the issue text.

Description

Describe the bug
brpc服务运行过程中coredump,查看corefile,发现是builtin_service导致的

#0  0x00007fa87f448baf in raise () from /lib64/libpthread.so.0
#1  0x0000000002443790 in backward::SignalHandling::sig_handler (signo=6, info=0x7fa2fd69d0f0, _ctx=0x7fa2fd69cfc0)
    at /data00/kernel/docker/dev-build-run/tcqa-table/build/vcpkg_installed/x64-linux/include/backward.hpp:4299
#2  <signal handler called>
#3  0x00007fa87d16852f in raise () from /lib64/libc.so.6
#4  0x00007fa87d13be65 in abort () from /lib64/libc.so.6
#5  0x000000000354ada7 in google::LogMessage::Fail ()
    at /root/vcpkg/buildtrees/glog/src/v0.7.1-795557b621.clean/src/logging.cc:1953
#6  0x000000000354e2aa in google::LogMessageFatal::~LogMessageFatal (this=0x7fa2fd69df40, __in_chrg=<optimized out>)
    at /root/vcpkg/buildtrees/glog/src/v0.7.1-795557b621.clean/src/logging.cc:2645
#7  0x0000000002be4a82 in brpc::VersionedRefWithId<brpc::Socket>::Dereference (this=0x7fa35a8bc800)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/versioned_ref_with_id.h:576
#8  0x0000000002d0f022 in brpc::DereferenceSocket (s=0x7fa35a8bc800)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/socket.cpp:2275
#9  0x0000000002b194fe in brpc::VersionedRefWithIdDeleter<brpc::Socket>::operator() (this=0x7fa2fd69e390, m=0x7fa35a8bc800)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/socket_id.h:46
#10 0x0000000002b1a30a in std::unique_ptr<brpc::Socket, brpc::VersionedRefWithIdDeleter<brpc::Socket> >::~unique_ptr (
    this=0x7fa2fd69e390, __in_chrg=<optimized out>) at /opt/rh/gcc-toolset-10/root/usr/include/c++/10/bits/unique_ptr.h:361
#11 0x0000000002d108e7 in brpc::Socket::DebugSocket (os=..., id=17179869742)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/socket.cpp:2565
#12 0x0000000002cfebe9 in brpc::SocketsService::default_method (this=0x7fa877946ae8, cntl_base=0x7fa362a69f00,
    done=0x7fa1e9b1fe00) at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/builtin/sockets_service.cpp:46
#13 0x0000000002d60b88 in brpc::sockets::CallMethod (this=0x7fa877946ae8, method=0x7fa877b917e0, controller=0x7fa362a69f00,
    request=0x7fa2eadb71a0, response=0x7fa266510040, done=0x7fa1e9b1fe00)
    at /root/vcpkg/buildtrees/brpc/x64-linux-dbg/brpc/builtin_service.pb.cc:3941
#14 0x0000000002be2714 in brpc::policy::ProcessHttpRequest (msg=0x7fa362a69c10)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/policy/http_rpc_protocol.cpp:1645
#15 0x0000000002b70e50 in brpc::ProcessInputMessage (void_arg=0x7fa362a69c10)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/input_messenger.cpp:177
#16 0x0000000002b70f45 in brpc::InputMessenger::InputMessageClosure::~InputMessageClosure (this=0x7fa2fd69ed80,
    __in_chrg=<optimized out>) at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/input_messenger.cpp:213
#17 0x0000000002b71d33 in brpc::InputMessenger::OnNewMessages (m=0x7fa31eb04f40)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/input_messenger.cpp:399
--Type <RET> for more, q to quit, c to continue without paging--f 6
#18 0x0000000002d09c00 in brpc::Socket::ProcessEvent (arg=0x7fa31eb04f40)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/brpc/socket.cpp:1185
#19 0x0000000002b03967 in bthread::TaskGroup::task_runner (skip_remained=0)
    at /root/vcpkg/buildtrees/brpc/src/1.11.0-fbf5526c8b.clean/src/bthread/task_group.cpp:305
#20 0x0000000002a999c1 in bthread_make_fcontext ()
#21 0x0000000000000000 in ?? ()

Versions
OS: rhel8.2
Compiler: gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)
brpc: 1.11.0
protobuf: 3.21.8

Dominant language
C++
Stars
17.6k
Forks
4.2k
Avg merge
3d 17h
Merged PRs (30d)
72

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/brpc

All issues in apache/brpc

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.