Skip to content

crash on linux; when i user the cpprestsdk client. here is the problem! can somebody solve it? #1235

Open
@sjmr201107

Description

@sjmr201107

`` void CHttpMsgHandle::msgPut(const string& errorName, const string& status, const string& msg)
{
try
{
web::json::value strJson;
strJson[U("service_name")] = web::json::value::string(U("FMASystem"));
strJson[U("service_id")] = web::json::value::string(U("2"));
strJson[U("error_name")] = web::json::value::string(utility::conversions::to_string_t(errorName));
strJson[U("business_status")] = web::json::value::string(utility::conversions::to_string_t(status));
strJson[U("business_message")] = web::json::value::string(utility::conversions::to_string_t(msg));

        web::http::http_request request;
        web::http::uri_builder builder;
        builder.append_path(m_httpInfo.suffixPut);
        request.set_request_uri(builder.to_uri());
        request._set_base_uri(m_httpInfo.address);
        request.headers().clear();
        request.headers().add(U("Content-Type"), U("application/json"));
        request.headers().set_content_type(U("application/json; charset=UTF-8"));
        request.set_method(web::http::methods::PUT);
        request.set_body(strJson);
        WEB_HTTP::http_client clientPut(m_httpInfo.address);
        web::http::http_response abc = clientPut.request(request).get();

    }
    catch (const std::exception& e)
    {
        BF fmt = (BF("[%1%]error %2%, msg = %3% ") % __FUNCTION__%e.what() %msg);
        cout << e.what() << endl;
    }

}

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./fma2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd0239db633 in web::http::client::details::asio_connection_pool::release(std::shared_ptrweb::http::client::details::asio_connection const&) () from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
[Current thread is 1 (Thread 0x7fd01d87d700 (LWP 11460))]
(gdb) bt
#0 0x00007fd0239db633 in web::http::client::details::asio_connection_pool::release(std::shared_ptrweb::http::client::details::asio_connection const&) () from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
#1 0x00007fd0239e0413 in web::http::client::details::asio_context::~asio_context() ()
from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
#2 0x00007fd0238d2696 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() ()
from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
#3 0x00007fd0239da63e in boost::asio::detail::reactive_socket_send_op<boost::asio::const_buffers_1, boost::asio::detail::write_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_serviceboost::asio::ip::tcp >, boost::asio::const_buffers_1, boost::asio::detail::transfer_all_t, boost::asio::detail::write_streambuf_handler<std::allocator, boost::_bi::bind_t<void, boost::_mfi::mf1<void, web::http::client::details::asio_context, boost::system::error_code const&>, boost::_bi::list2<boost::_bi::value<std::shared_ptrweb::http::client::details::asio_context >, boost::arg<1> ()()> > > > >::do_complete(boost::asio::detail::task_io_service, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
#4 0x00007fd0239cc921 in crossplat::threadpool::thread_start(void*) () from /usr/lib/x86_64-linux-gnu/libcpprest.so.2.8
#5 0x00007fd0248806ba in start_thread (arg=0x7fd01d87d700) at pthread_create.c:333
#6 0x00007fd022f5141d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions