Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coredump #177

Closed
jxfwinter opened this issue Jun 25, 2018 · 4 comments
Closed

coredump #177

jxfwinter opened this issue Jun 25, 2018 · 4 comments

Comments

@jxfwinter
Copy link

jxfwinter commented Jun 25, 2018

I not use example asio/round_robin.hpp, but use the asio/yield.hpp

root@localhost bin]# gdb -c core.27184 ws_call_server
GNU gdb (GDB) Red Hat Enterprise Linux 8.0.1-36.el7
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ws_call_server...done.
[New LWP 27184]
[New LWP 27189]
[New LWP 27186]
[New LWP 27191]
[New LWP 27190]
[New LWP 27192]
[New LWP 27188]
[New LWP 27185]
[New LWP 27187]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./ws_call_server'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  std::__exchange<void*, decltype(nullptr)>(void*&, decltype(nullptr)&&) (__new_val=<optimized out>, __obj=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/move.h:150
150           _Tp __old_val = std::move(__obj);
[Current thread is 1 (Thread 0x7f61c72468c0 (LWP 27184))]
Missing separate debuginfos, use: debuginfo-install glibc-2.17-222.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-19.el7.x86_64 libcom_err-1.42.9-11.el7.x86_64 libgcc-4.8.5-28.el7.x86_64 libselinux-2.5-12.el7.x86_64 libstdc++-4.8.5-28.el7.x86_64 openssl-libs-1.0.2k-12.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-17.el7.x86_64
(gdb) bt
#0  std::__exchange<void*, decltype(nullptr)>(void*&, decltype(nullptr)&&) (__new_val=<optimized out>, __obj=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/move.h:150
#1  std::exchange<void*, decltype(nullptr)>(void*&, decltype(nullptr)&&) (__new_val=<optimized out>, __obj=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/utility:282
#2  boost::context::fiber::resume_with<boost::fibers::context::resume(boost::fibers::detail::spinlock_lock&)::<lambda(boost::context::fiber&&)> > (fn=..., this=<optimized out>)
    at ./boost/context/fiber_fcontext.hpp:293
#3  boost::fibers::context::resume (this=0x0, lk=...) at libs/fiber/src/context.cpp:163
#4  0x000000000055f8a8 in boost::fibers::scheduler::wait_until (this=<optimized out>, ctx=ctx@entry=0xe1a66b00, sleep_tp=..., lk=...) at libs/fiber/src/scheduler.cpp:318
#5  0x000000000055b5c5 in boost::fibers::context::wait_until (this=this@entry=0xe1a66b00, tp=..., lk=...) at libs/fiber/src/context.cpp:268
#6  0x00000000004be1a2 in boost::fibers::condition_variable_any::wait_until<std::unique_lock<boost::fibers::mutex>, std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (timeout_time_=..., lt=..., this=0x23b7aa10) at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/condition_variable.hpp:109
#7  boost::fibers::condition_variable_any::wait_until<std::unique_lock<boost::fibers::mutex>, std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> >, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}>(std::unique_lock<boost::fibers::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}) (pred=...,
    timeout_time=..., lt=..., this=0x23b7aa10) at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/condition_variable.hpp:133
#8  boost::fibers::condition_variable_any::wait_for<std::unique_lock<boost::fibers::mutex>, long, std::ratio<1l, 1l>, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}>(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}) (pred=..., timeout_duration=..., lt=..., this=0x23b7aa10)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/condition_variable.hpp:150
#9  boost::fibers::condition_variable::wait_for<long, std::ratio<1l, 1l>, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}>(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&, boost::fibers::future_status boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> >(std::unique_lock<boost::fibers::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&) const::{lambda()#1}) (pred=..., timeout_duration=..., lt=..., this=0x23b7aa10) at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/condition_variable.hpp:238
#10 boost::fibers::detail::shared_state_base::wait_for_<long, std::ratio<1l, 1l> > (timeout_duration=..., lk=..., this=0x23b7aa00)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/future/detail/shared_state.hpp:88
#11 boost::fibers::detail::shared_state_base::wait_for<long, std::ratio<1l, 1l> > (timeout_duration=..., this=0x23b7aa00)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/future/detail/shared_state.hpp:134
#12 boost::fibers::detail::future_base<std::string>::wait_for<long, std::ratio<1l, 1l> > (timeout_duration=..., this=<synthetic pointer>)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/future/future.hpp:86
#13 WsCallServer::<lambda(std::string)>::operator()(std::string) const (__closure=<optimized out>, body="this is a server requset") at /root/git_abc/server_kit/example/stress_test/ws_call_server.cpp:274
#14 0x00000000004bf174 in std::_Function_handler<std::basic_string<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), WsCallServer::session(SocketPtr)::<lambda(std::string)> >::_M_invoke(const std::_Any_data &, std::basic_string<char, std::char_traits<char>, std::allocator<char> > &&) (__functor=..., __args#0=...)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/std_function.h:302
#15 0x000000000050ccf5 in std::function<std::string (std::string)>::operator()(std::string) const (
    __args#0="\270\023\177\000\000\000\000\000 \000\000\000\000\000\000\000\250i\246\341\000\000\000\000\275\261)\306a\177\000\000@\364\nt\000\000\000\000@N\326\001\000\000\000\000\220\251K\000\000\000\000\000P\361K\000\000\000\000\000\200\037\000\000\177\003\000\000\000j\246\341\000\000\000\000\217\001V\000\000\000\000\000\214\000\000\000\000\000\000\000\347i\246\341\000\000\000\000\000x\206\350\000\000\000\000\347i\246\341\000\000\000\000K\211P\000\000\000\000\000\200\037\000\000\177\003\000\000\214\000\000\000\000\000\000\000\347i\246\341", '\000' <repeats 12 times>, "\020\211P\000\000\000\000\000\217\001V\000\000\000\000\000\214\000\000\000\000\000\000\000\217\001V\000\000\000\000\000\330j\246\341\000\000\000\000"..., this=0xe1a66920) at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/std_function.h:706
#16 TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}::operator()() const (__closure=0xe1a66920) at /root/git_abc/server_kit/example/stress_test/test_websocket_server.hpp:37
#17 boost::context::detail::invoke<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>(std::decay<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::type, std::enable_if&&) (fn=...) at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/detail/invoke.hpp:41
#18 boost::context::detail::apply_impl<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}, std::tuple<>>(TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}&&, std::tuple&&, std::integer_sequence<unsigned long>) (tpl=..., fn=...) at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/detail/apply.hpp:46
#19 boost::context::detail::apply<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}, std::tuple<> > (tpl=..., fn=...) at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/detail/apply.hpp:59
#20 boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::run_(boost::context::fiber&&) (this=0xe1a66b00, c=...) at /root/git_abc/server_kit/example/stress_test/../../include/boost/fiber/context.hpp:431
#21 0x000000000050894b in std::__invoke_impl<boost::context::fiber, boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*&)(boost::context::fiber&&), {lambda(std::string)#1}*&, boost::context::fiber>(std::__invoke_memfun_deref, boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*&)(boost::context::fiber&&), {lambda(std::string)#1}*&, boost::context::fiber&&) (__t=<optimized out>, __f=<optimized out>)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/invoke.h:73
#22 std::__invoke<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*&)(TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1---Type <return> to continue, or q <return> to quit---
}::operator()(std::string) const::{lambda()#1}&&), {lambda(std::string)#1}*&, TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>({lambda(std::string)#1}*&&, ({lambda(std::string)#1}*&)...) (__fn=<optimized out>)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/invoke.h:96
#23 std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))(TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}&&)>::__call<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}, boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>, 0ul, 1ul>(std::tuple<boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}> >&&, std::_Index_tuple<0ul, 1ul>) (__args=...,
    this=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/functional:469
#24 std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))(TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}&&)>::operator()<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}, TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>(TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}&&) (this=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/functional:551
#25 boost::context::detail::invoke<std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))({lambda()#1}&&)>&, {lambda()#1}>(std::decay<std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))({lambda()#1}&&)>&>::type, std::enable_if&&) (fn=...)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/detail/invoke.hpp:41
#26 boost::context::detail::fiber_record<boost::context::fiber, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))(boost::context::fiber&&)> >::run(void*) (fctx=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/fiber_fcontext.hpp:139
#27 boost::context::detail::fiber_entry<boost::context::detail::fiber_record<boost::context::fiber, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, std::_Bind<boost::context::fiber (boost::fibers::worker_context<TestWebsocketServer::TestWebsocketServer(std::string, int)::{lambda(WsCallContext&)#1}::operator()(WsCallContext&) const::{lambda(std::string)#1}::operator()(std::string) const::{lambda()#1}>::*({lambda(std::string)#1}*, std::_Placeholder<1>))(boost::context::fiber&&)> > >(boost::context::detail::transfer_t) (t=...)
    at /root/git_abc/server_kit/example/stress_test/../../include/boost/context/fiber_fcontext.hpp:80

#28 0x000000000056018f in make_fcontext () at libs/context/src/asm/make_x86_64_sysv_elf_gas.S:70
#29 0x00000000e1a66ad8 in ?? ()
#30 0x00007f61c62faaab in std::string::reserve(unsigned long) () from /lib64/libstdc++.so.6
#31 0x00000000e1a66cf0 in ?? ()
#32 0x0000000000020000 in ?? ()
#33 0x000000000050cc60 in ?? ()
#34 0x0000000000000000 in ?? ()
@olk
Copy link
Member

olk commented Jun 25, 2018

could you provide a smaller test app? otherwise it would be difficult without debugging.

@jxfwinter
Copy link
Author

I think problem is unbuffered_channel::push_wait_for, when I replace it with unbuffered_channel::push, whether I use asio/round_robin.hpp or not, there is no coredump。
when use unbuffered_channel::push_wait_for in the fiber, use unbuffered_channel::value_pop in other fiber, and use unbuffered_channel::close in last fiber,this coredump appear。
I noticed unbuffered_channel::push_wait_for was not in document, is unbuffered_channel::push_wait_for not recommended?

@olk
Copy link
Member

olk commented Jun 25, 2018

unbuffered_channel::push_wait_for() should be in the domcuemntation - maybe an oversight

@olk
Copy link
Member

olk commented Jun 25, 2018

unbuffered_channel::push_wait_for() implements isn't easy because it has to synchronize between signaled by the condition and timeout (done by the scheduler) - maybe there are some odds (the protocol is based on atomics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants