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

random crash from ccapi_session #471

Open
grownalchemist opened this issue May 30, 2024 · 0 comments
Open

random crash from ccapi_session #471

grownalchemist opened this issue May 30, 2024 · 0 comments

Comments

@grownalchemist
Copy link

grownalchemist commented May 30, 2024

Describe the bug
I'm getting a strange, intermittent/random crash with this very simple code which runs for a few hours then crashes. Note I am building using CCAPI_USE_SINGLE_THREAD (not sure if this matters).

The crash:

Thread 6 "main" received signal SIGSEGV, Segmentation fault.                                                                                                                                                                                                                                   [29/1828]
[Switching to Thread 0x7ffec2ab9000 (LWP 1736282)]                                                          
0x0000555555c8b0dd in SSL_connect (ssl=0x7ffe00000000) at external/openssl/src/ssl/ssl_lib.cc:882           
882     external/openssl/src/ssl/ssl_lib.cc: No such file or directory.                                     
(gdb) bt                                                                                                    
#0  0x0000555555c8b0dd in SSL_connect (ssl=0x7ffe00000000) at external/openssl/src/ssl/ssl_lib.cc:882       
#1  0x0000555555c76217 in boost::asio::ssl::detail::engine::do_connect (this=0x7ffe90d39e80)                
    at external/boost/boost/asio/ssl/detail/impl/engine.ipp:353                                             
#2  0x0000555555c75f78 in boost::asio::ssl::detail::engine::perform (this=0x7ffe90d39e80,                   
    op=(int (boost::asio::ssl::detail::engine::*)(boost::asio::ssl::detail::engine * const, void *, std::size_t)) 0x555555c761f0 <boost::asio::ssl::detail::engine::do_connect(void*, unsigned long)>, data=0x0, 
    length=0, ec=..., bytes_transferred=0x0) at external/boost/boost/asio/ssl/detail/impl/engine.ipp:280    
#3  0x0000555555c75a8c in boost::asio::ssl::detail::engine::handshake (this=0x7ffe90d39e80,                 
    type=boost::asio::ssl::stream_base::client, ec=...)                                                     
    at external/boost/boost/asio/ssl/detail/impl/engine.ipp:180                                             
#4  0x00005555556b74df in boost::asio::ssl::detail::handshake_op::operator() (this=0x7ffec2a8fe50,          
    eng=..., ec=..., bytes_transferred=@0x7ffec2a8fe78: 0)                                                  
    at external/boost/boost/asio/ssl/detail/handshake_op.hpp:47                                             
#5  0x00005555558947c3 in boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr
<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > >::operator() (this=0x7ffec2a8fe38, ec=..., bytes_transferred=171, start=0)                                                                                                
    at external/boost/boost/asio/ssl/detail/io.hpp:154                                                      
#6  0x0000555555931189 in boost::beast::async_base<boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Se
rvice::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > >, boost::asio::any_io_executor, std::allocator<void> >::complete_now<boost::system::error_code&, unsigned long&> (this=0x7ffec2a8fe30) at external/
boost/boost/beast/core/async_base.hpp:428                                                                   
#7  0x0000555555922c10 in boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_
io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > >
 >::operator() (this=0x7ffec2a8fe30, ec=...,                                                                
    bytes_transferred=171) at external/boost/boost/beast/core/impl/basic_stream.hpp:429                     
#8  0x00005555559cabe3 in boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asi
o::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared
_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>::operator() (this=0x7ffec2a8fe30)                                       
    at external/boost/boost/asio/detail/bind_handler.hpp:289                                                
#9  0x00005555559cab8a in boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boos
t::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared
_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> > (function=...)                       
    at external/boost/boost/asio/handler_invoke_hook.hpp:88                                                 
#10 0x00005555559bc0e0 in boost::beast::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::i
o_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), st
d::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>&> (f=..., op=0x7ffec2a8fe80)                                                                                                                                                     
    at external/boost/boost/beast/core/detail/bind_handler.hpp:287                                          
#11 0x00005555559ad589 in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::i
o_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), st
d::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_p
tr<ccapi::WsConnection> > > (function=..., context=...)                                                     
    at external/boost/boost/asio/detail/handler_invoke_helpers.hpp:54                                       
#12 0x000055555599faf0 in boost::asio::ssl::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detai
l::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code)
, std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::det
ail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > (                                                                                                        
    function=..., this_handler=0x7ffec2a8fe38) at external/boost/boost/asio/ssl/detail/io.hpp:374           
#13 0x0000555555994427 in boost::beast::asio_handler_invoke<boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (
ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > >, boost::asio::any_io_executor, std::allocator<void>, boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost:
:asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::hand
shake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>&> (f=..., p=0x7ffec2a8fe30)      
    at external/boost/boost/beast/core/impl/async_base.hpp:64                                               
#14 0x000055555598a13e in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::i
o_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), st
d::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost:
:asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::sy
stem::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > > > (                                                 
    function=..., context=...) at external/boost/boost/asio/detail/handler_invoke_helpers.hpp:54            
#15 0x00005555559ea314 in boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io
_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<c--Type <RET> for more, q to quit, c to continue with
out paging--                                                                                                
capi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::trans
fer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service:
:*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> (function=..., this_handler=0x7ffec2a8fe30)                                                              
    at external/boost/boost/asio/detail/bind_handler.hpp:344                                                
#16 0x00005555559dad6e in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::i
o_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), st
d::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::as
io::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<cc
api::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> > (function=..., context=...)                                                                                                  
    at external/boost/boost/asio/detail/handler_invoke_helpers.hpp:54                                       
#17 0x00005555559cadc5 in boost::asio::detail::executor_function::complete<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::de
tail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_co
de), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, std::allocator<void> > (                                                                                                                                                 
    base=0x7ffe60234ca0, call=true) at external/boost/boost/asio/detail/executor_function.hpp:116           
#18 0x00005555556b477d in boost::asio::detail::executor_function::operator() (this=0x7ffec2a900b0)          
    at external/boost/boost/asio/detail/executor_function.hpp:64                                            
#19 0x0000555555917788 in boost::asio::asio_handler_invoke<boost::asio::detail::executor_function> (        
    function=...) at external/boost/boost/asio/handler_invoke_hook.hpp:88                                                                           
#20 0x0000555555900ea8 in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::executor_function, boost::asio::detail::executor_function> (function=..., context=...)                                                                                                                         
    at external/boost/boost/asio/detail/handler_invoke_helpers.hpp:54                                                                               
#21 0x0000555555936e52 in boost::asio::io_context::basic_executor_type<std::allocator<void>, 4ul>::execute<boost::asio::detail::executor_function> (this=0x7ffec2a903d8, f=...)                                                                                                                         
    at external/boost/boost/asio/impl/io_context.hpp:294                                                                                            
#22 0x000055555592ab21 in boost_asio_execution_execute_fn::impl::operator()<boost::asio::io_context::basic_executor_type<std::allocator<void>, 4ul> const&, boost::asio::detail::executor_function> (                                                                                                   
    this=0x555555f17a2a <boost_asio_execution_execute_fn::static_instance<boost_asio_execution_execute_fn::impl>::instance>, t=..., f=...) at external/boost/boost/asio/execution/execute.hpp:213                                                                                                       
#23 0x00005555559175c8 in boost::asio::execution::detail::any_executor_base::execute_ex<boost::asio::io_context::basic_executor_type<std::allocator<void>, 4ul> > (ex=..., f=...)                                                                                                                       
    at external/boost/boost/asio/execution/any_executor.hpp:1011                                                                                    
#24 0x000055555599fc0a in boost::asio::execution::detail::any_executor_base::execute<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asi
o::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system
::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> > (this=0x7ffec2a903d8,                                                                                                                                           
    f=...) at external/boost/boost/asio/execution/any_executor.hpp:788                                                                              
#25 0x0000555555994455 in boost_asio_execution_execute_fn::impl::operator()<boost::asio::any_io_executor&, boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable
_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConn
ection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> > (                                                                                                                                         
    this=0x555555f17a2a <boost_asio_execution_execute_fn::static_instance<boost_asio_execution_execute_fn::impl>::instance>, t=..., f=...) at external/boost/boost/asio/execution/execute.hpp:213                                                                                                       
#26 0x000055555598a177 in boost::asio::detail::handler_work_base<boost::asio::any_io_executor, boost::asio::any_io_executor, boost::asio::io_context, boost::asio::executor, void>::dispatch<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor,
 boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast:
:detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::a
sio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handsh
ake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > > > (                                                                             
    this=0x7ffec2a903d8, function=...) at external/boost/boost/asio/detail/handler_work.hpp:452                                                     
#27 0x0000555555980374 in boost::asio::detail::handler_work<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost
::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::s
hared_ptr<ccapi::WsConnection> > > >, boost::asio::any_io_executor, void>::complete<boost::asio::detail::binder2<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutable_buffers_1, boost::asio
::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsConnection>, boost::system:
:error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::system::error_code, unsigned long> > (this=0x7ffec2a903a0, function=..., handler=...)                                                                                                                 
    at external/boost/boost/asio/detail/handler_work.hpp:492                                                                                        
#28 0x00005555559759be in boost::asio::detail::reactive_socket_recv_op<boost::beast::buffers_prefix_view<boost::asio::mutable_buffers_1>, boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>::ops::transfer_op<true, boost::asio::mutab
le_buffers_1, boost::asio::ssl::detail::io_op<boost::beast::basic_stream<boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::unlimited_rate_policy>, boost::asio::ssl::detail::handshake_op, boost::beast::detail::bind_front_wrapper<void (ccapi::Service::*)(std::shared_ptr<ccapi::WsCo
nnection>, boost::system::error_code), std::shared_ptr<ccapi::Service>, std::shared_ptr<ccapi::WsConnection> > > >, boost::asio::any_io_executor>::do_complete (                                                                                                                                        
    owner=0x55555a440380, base=0x7ffe92e0aff0)                            
    at external/boost/boost/asio/detail/reactive_socket_recv_op.hpp:152                                                                             
#29 0x0000555555e33d98 in boost::asio::detail::scheduler_operation::complete (this=0x7ffe92e0aff0,                                                  
    owner=0x55555a440380, ec=..., bytes_transferred=0)                    
    at external/boost/boost/asio/detail/scheduler_operation.hpp:40                                                                                  
#30 0x0000555555e2610a in boost::asio::detail::scheduler::do_run_one (this=0x55555a440380, lock=...,                                                
    this_thread=..., ec=...) at external/boost/boost/asio/detail/impl/scheduler.ipp:493                                                             
--Type <RET> for more, q to quit, c to continue without paging--                                                                                    
#31 0x0000555555e2510a in boost::asio::detail::scheduler::run (this=0x55555a440380, ec=...)                                                         
    at external/boost/boost/asio/detail/impl/scheduler.ipp:210                                                                                      
#32 0x0000555555e1cc79 in boost::asio::io_context::run (this=0x555559335f20)                                                                        
    at external/boost/boost/asio/impl/io_context.ipp:64                                                                                             
#33 0x00005555556d4e6d in ccapi::ServiceContext::start (this=0x55555a051a60)                                                                        
    at src/third_party/ccapi/include/ccapi_cpp/service/ccapi_service_context.h:123                                                                  
#34 0x0000555555775d6c in ccapi::Session::start()::{lambda()#1}::operator()() const (                                                               
    __closure=0x5555593b2138) at src/third_party/ccapi/include/ccapi_cpp/ccapi_session.h:317                                                        
#35 0x0000555555c55671 in std::__invoke_impl<void, ccapi::Session::start()::{lambda()#1}>(std::__invoke_other, ccapi::Session::start()::{lambda()#1}&&) (__f=...) at /usr/include/c++/12/bits/invoke.h:61                                                                                               
#36 0x0000555555c553fc in std::__invoke<ccapi::Session::start()::{lambda()#1}>(ccapi::Session::start()::{lambda()#1}&&) (__fn=...) at /usr/include/c++/12/bits/invoke.h:96                                                                                                                              
#37 0x0000555555c549ea in std::thread::_Invoker<std::tuple<ccapi::Session::start()::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x5555593b2138) at /usr/include/c++/12/bits/std_thread.h:279                                                                                          
#38 0x0000555555c5364a in std::thread::_Invoker<std::tuple<ccapi::Session::start()::{lambda()#1}> >::operator()() (this=0x5555593b2138) at /usr/include/c++/12/bits/std_thread.h:286                                                                                                                    
#39 0x0000555555c50ca0 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<ccapi::Session::start()::{lambda()#1}> > >::_M_run() (this=0x5555593b2130) at /usr/include/c++/12/bits/std_thread.h:231                                                                                             
#40 0x00007ffef80dc253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6                                                                           
#41 0x00007ffef7c94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442                                                         
#42 0x00007ffef7d26850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81                                                                

The code:

class MyEventHandler : public EventHandler {
 public:
  MarketDataEventHandler() {}

  bool processEvent(const Event& event, Session* session) override {
    std::cout << event.toStringPretty(2, 2) << std::endl;
    return true;
  }
};

void main() {
  Subscription binance_depth_subscription(
      "binance", "BTCUSDT", "MARKET_DEPTH",
      "",
      "abc");
  Subscription gateio_depth_subscription("gateio","BTC_USDT", "MARKET_DEPTH",
                                         "",
                                         "def");
  SessionOptions sessionOptions;
  SessionConfigs sessionConfigs;
  MyEventHandler handler;
  Session session(sessionOptions, sessionConfigs, &handler);
  session.subscribe({binance_depth_subscription, gateio_depth_subscription});
  std::this_thread::sleep_for(std::chrono::hours(10));
  session.stop();
  return EXIT_SUCCESS;
}

To Reproduce
Steps to reproduce the behavior:

  1. Run the above code in a main.cc with CCAPI_USE_SINGLE_THREAD for a few hours.

Expected behavior
Code works without crashing intermittently.

Screenshots
N/A

Additional context
Running on Linux Ubuntu 22.04 built using Bazel and gcc 11.4.0. Backtrace from gdb.

@grownalchemist grownalchemist changed the title Is session.sendRequest() actually thread-safe? random crash from ccapi_session May 30, 2024
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

1 participant