cpp-netlib issue, terminate called after throwing an instance of 'boost::exception_detail::clone_impl

2.4k Views Asked by At

I have the below code executing in a loop which has exception handling.

 using namespace boost::network;
            http::client client;
            http::client::request request("https://testserver.com/");
            request << header("Connection", "close");
            http::client::response response = client.get(request);
            std::string strOutput = body(response);

The code runs fine however if I disable my network interface to test my software in case of network failure I receive this error,

terminate called after throwing an instance of 'boost::exception_detail::clone_impl >' what(): boost thread: trying joining itself: Resource deadlock avoided

I can't seem to catch this error. This code performs a status check 24/7 so it most likely will find a time when there is a network error. The worst part is that it may fail after 1, 2, 3, or on the 4th try. I would really like to avoid implementing the HTTP protocol socket myself with sockets but I may need to. Any ideas?

1

There are 1 best solutions below

0
On

The author of library found the solution to be using the same instance of the client and not creating/destroying it each time