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

thread bug cause core dump! #248

Closed
oleacs opened this issue Sep 28, 2017 · 0 comments
Closed

thread bug cause core dump! #248

oleacs opened this issue Sep 28, 2017 · 0 comments

Comments

@oleacs
Copy link

oleacs commented Sep 28, 2017

the code:

#include
#include
#include
#include
#include

using namespace std;
using namespace restbed;

void get_method_handler( const shared_ptr< Session > session )
{
session->close( OK, "Hello, World!", { { "Content-Length", "13" } } );
}

void test()
{
auto request = make_shared< Request >( Uri( "http://10.45.80.26/zcm-application/applications/2051" ) );
request->set_header( "Accept", "/" );

auto response = Http::sync( request );

fprintf( stderr, "*** Response ***\n" );
fprintf( stderr, "Status Code:    %i\n", response->get_status_code( ) );
fprintf( stderr, "Status Message: %s\n", response->get_status_message( ).data( ) );
fprintf( stderr, "HTTP Version:   %.1f\n", response->get_version( ) );
fprintf( stderr, "HTTP Protocol:  %s\n", response->get_protocol( ).data( ) );

}

int main( const int, const char** )
{
auto resource = make_shared< Resource >( );
resource->set_path( "/resource" );
resource->set_method_handler( "GET", get_method_handler );

auto settings = make_shared< Settings >( );
settings->set_port( 1984 );
settings->set_default_header( "Connection", "close" );

Service service;
service.publish( resource );
service.schedule( test, chrono::milliseconds( 1000 ) );

service.start( settings );

return EXIT_SUCCESS;

}

core info:
Reading symbols from /home/smartguys/src/ocsr90/lss/bin/Test...(no debugging symbols found)...done.
[New LWP 19725]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `./Test'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007ffff7ba2a27 in std::_Function_handler<void (std::shared_ptrrestbed::Session), restbed::detail::ServiceImpl::create_session(std::shared_ptr<asio::basic_stream_socketasio::ip::tcp > const&, std::error_code const&) const::{lambda(std::shared_ptrrestbed::Session)#1}>::_M_invoke(std::_Any_data const&, std::shared_ptrrestbed::Session&&) () from /home/smartguys/tools/runtime/lib/librestbed.so.4
Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7_3.1.x86_64 libgcc-4.8.5-11.el7.x86_64 libstdc++-4.8.5-11.el7.x86_64
(gdb) where
#0 0x00007ffff7ba2a27 in std::_Function_handler<void (std::shared_ptrrestbed::Session), restbed::detail::ServiceImpl::create_session(std::shared_ptr<asio::basic_stream_socketasio::ip::tcp > const&, std::error_code const&) const::{lambda(std::shared_ptrrestbed::Session)#1}>::_M_invoke(std::_Any_data const&, std::shared_ptrrestbed::Session&&) () from /home/smartguys/tools/runtime/lib/librestbed.so.4
#1 0x00007ffff7b8570e in restbed::SessionManager::create(std::function<void (std::shared_ptrrestbed::Session)> const&) ()
from /home/smartguys/tools/runtime/lib/librestbed.so.4
#2 0x00007ffff7ba0881 in restbed::detail::ServiceImpl::create_session(std::shared_ptr<asio::basic_stream_socketasio::ip::tcp > const&, std::error_code const&) const () from /home/smartguys/tools/runtime/lib/librestbed.so.4
#3 0x00007ffff7bab030 in asio::detail::reactive_socket_accept_op<asio::basic_socketasio::ip::tcp, asio::ip::tcp, std::_Bind<std::_Mem_fn<void (restbed::detail::ServiceImpl::)(std::shared_ptr<asio::basic_stream_socketasio::ip::tcp > const&, std::error_code const&) const> (restbed::detail::ServiceImpl const, std::shared_ptr<asio::basic_stream_socketasio::ip::tcp >, std::_Placeholder<1>)> >::do_complete(void*, asio::detail::scheduler_operation*, std::error_code const&, unsigned long) () from /home/smartguys/tools/runtime/lib/librestbed.so.4
#4 0x00007ffff7b9a26e in asio::detail::epoll_reactor::descriptor_state::do_complete(void*, asio::detail::scheduler_operation*, std::error_code const&, unsigned long) () from /home/smartguys/tools/runtime/lib/librestbed.so.4
#5 0x00007ffff7b6c322 in restbed::Service::start(std::shared_ptr<restbed::Settings const> const&) ()
from /home/smartguys/tools/runtime/lib/librestbed.so.4
#6 0x00000000004031e9 in main ()

@oleacs oleacs closed this as completed Sep 28, 2017
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