baidu / baidu/sofa-pbrpc

C++11编译运行Segmentation fault.

Open
#68 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.1k
Forks
649
PR merge metrics
No merged PRs in 30d

Description

Hi,升级c++11以后,编译没问题,但是运行初始化client的时候会挂。

gdb如下:

Program terminated with signal 11, Segmentation fault.
#0 signal_and_unlockboost::asio::detail::scoped_lock (this=0xd2ae4c80, lock=...) at thirdparty/boost/asio/detail/posix_event.hpp:60

60 signalled_ = true;
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.el6_7.3.x86_64 zlib-1.2.3-29.el6.x86_64

core文件bt如下:
#0 signal_and_unlockboost::asio::detail::scoped_lock (this=0xd2ae4c80, lock=...) at thirdparty/boost/asio/detail/posix_event.hpp:60
#1 wake_one_idle_thread_and_unlock (this=0xd2ae4c80, lock=...) at thirdparty/boost/asio/detail/impl/task_io_service.ipp:484
#2 boost::asio::detail::task_io_service::wake_one_thread_and_unlock (this=0xd2ae4c80, lock=...) at thirdparty/boost/asio/detail/impl/task_io_service.ipp:493
#3 0x000000000054f32e in boost::asio::detail::task_io_service::init_task (this=0xd2ae4c80) at thirdparty/boost/asio/detail/impl/task_io_service.ipp:130
#4 0x0000000000552307 in init_task (this=0x2b0b918, io_service=Unhandled dwarf expression opcode 0xf3

) at thirdparty/boost/asio/detail/impl/epoll_reactor.ipp:145
#5 boost::asio::detail::deadline_timer_serviceboost::asio::time_traits::deadline_timer_service (this=0x2b0b918, io_service=Unhandled dwarf expression opcode 0xf3

) at thirdparty/boost/asio/detail/deadline_timer_service.hpp:68
#6 0x00000000005523a6 in deadline_timer_service (owner=...) at thirdparty/boost/asio/deadline_timer_service.hpp:77
#7 boost::asio::detail::service_registry::create > > (owner=...) at thirdparty/boost/asio/detail/impl/service_registry.hpp:81
#8 0x000000000054c4a6 in boost::asio::detail::service_registry::do_use_service (this=0xd2add000, key=..., factory=0x552350 > >(boost::asio::io_service&)>)

```
at thirdparty/boost/asio/detail/impl/service_registry.ipp:123
```
#9 0x000000000055076e in use_service > > (this=0x2b1aac8, io_service=Unhandled dwarf expression opcode 0xf3

) at thirdparty/boost/asio/detail/impl/service_registry.hpp:48
#10 use_service > > (this=0x2b1aac8, io_service=Unhandled dwarf expression opcode 0xf3

) at thirdparty/boost/asio/impl/io_service.hpp:33
#11 boost::asio::basic_io_object > >::basic_io_object (this=0x2b1aac8, io_service=Unhandled dwarf expression opcode 0xf3

) at thirdparty/boost/asio/basic_io_object.hpp:90
#12 0x0000000000707791 in basic_deadline_timer (this=0x2b1aa80, io_service=...) at thirdparty/boost/asio/basic_deadline_timer.hpp:149
#13 sofa::pbrpc::TimerWorker::TimerWorker (this=0x2b1aa80, io_service=...) at ./sofa/pbrpc/timer_worker.h:27
#14 0x00000000006fc16f in sofa::pbrpc::RpcClientImpl::Start (this=0x2b26c00) at sofa/pbrpc/rpc_client_impl.cc:88
#15 0x00000000006fad5c in sofa::pbrpc::RpcClient::RpcClient (this=0xd29f76a0, options=Unhandled dwarf expression opcode 0xf3

) at sofa/pbrpc/rpc_client.cc:16
#16 0x000000000053dc6d in XXXX::XXXX::SofaClientInit (this=0x2b68000) at xxx/xxx/xxxx/XXXCore.cpp:347

f 16如下:

client_options_ = (new sofa::pbrpc::RpcClientOptions());
345 client_options_->work_thread_num = work_thread_num;
346 client_options_->callback_thread_num = callback_thread_num;
347 rpc_client_ = (new sofa::pbrpc::RpcClient(*client_options_));
348 sofa_client_ = (new sofa::client::SofaClient());
349 sofa_client_->Init(rpc_client_,ip_list_str);

错误出现在347行

请问这是已知错误吗?有解决方案吗?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the C++11 client initialization failure under gdb and inspect the stack from sofa/pbrpc/rpc_client.cc:16 through sofa/pbrpc/rpc_client_impl.cc:88 and sofa/pbrpc/timer_worker.h:27. Then trace the Boost.Asio service construction at the reported thirdparty/boost/asio files and the caller at XXXCore.cpp:347. Done means identifying the cause and confirming that RpcClient initialization no longer segfaults.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.