You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I cannot build version 0.12 with VS2015, I tried the latest version in the 0.13-release branch (6a7e92c).
I can build this version successfully (with VS2015, Boost 1.62.0, OpenSsl 1.0.2j) but when I try this simple code I get an unhandled exception in the last line of the try-block where I try to access the body.
The error message is: "Unhandled exception at 0x75BDC54F in Test.exe: Microsoft C++ exception: boost::exception_detail::clone_implstd::exception_ptr at memory location 0x002CFC40."
I'll assume that you have a server running on the IPv4 address 127.0.0.1:8000. If you try with an IPv6 address instead ([::1]:8000) and still get the error, then I don't know and might need to get a bit more detailed debugging information.
If you don't get the error by connecting to an IPv6 address, then I suspect this is because of a bug with address resolution potentially failing and causing an exception to be thrown in the background thread. You should actually be able to reach into the boost exception pointer to get the actual wrapped exception to see what the thrown error is.
I would think this is address resolution, or something to do with the actual HTTP handling.
At this point I would think this is working as intended, because the error was propagated as an exception and is something that you should be able to handle and recover from. Documentation on Boost.Exception should help with finding out what the exact exception is.
Thank you for your response!
I get the same exception with the IPv6 address.
The problem is that it is an unhandled exception. I don't end up in my catch block but instead the debugger breaks. So I don't see how I could handle and recover from this exception.
Here you can see the call stack at the time when the debugger breaks. And these are the locals at the current position of the call stack.
This issue reminds me of something similar in terms of not catching the exception. This related function is the only place where we use cpp-netlib for http handling (similar to the above sample).
I think I'm running into something similar. I finally tracked it down to a std::exception_ptr being thrown directly. I had to do the following to get the true exception, which turned out to be an ssl system error. This is using the 0.13 branch.
try
{
try
{
net::http::client::request request("https://www.google.com/");
request << net::header("Connection", "close");
net::http::client client;
net::http::client::response response = client.get(request);
std::string body = net::http::body(response);
std::cout << body;
}
catch (const std::exception_ptr& ex)
{
// For some reason, the http code is throwing an exception_ptr,// which needs to be re-thrown to get the true exception.std::rethrow_exception(ex);
}
}
catch (const boost::system::system_error& ex)
{
std::cerr << "ERROR: " << boost::diagnostic_information(ex) << std::endl;
return ex.code().value();
}
As just now opened in monero-project/kovri#490, this issue may also arise when connecting to servers with expired certificates. Can anyone else confirm?
As noted in monero-project/kovri#453 (comment), this issue also arose recently in arm64 (Linaro/Debian Jessie) with an openssl update (I don't yet have the details on package versions or any related details)Edit: running version 1.1 (not producible when reverted back to 1.0.2j).
Hi @anonimal -- is this something we can fix on the cpp-netlib side? Or is this something wrong with how ASIO is handling it? I'd appreciate a pull request to make this less of a problem for users.
Hi Dean, I don't know: I haven't looked deeper into the issue and, because of kovri-things, I won't be able to bug hunt anytime soon. I'll be happy to do that though when I can make the time to do so.
Activity
deanberris commentedon Oct 12, 2016
I'll assume that you have a server running on the IPv4 address
127.0.0.1:8000. If you try with an IPv6 address instead ([::1]:8000) and still get the error, then I don't know and might need to get a bit more detailed debugging information.If you don't get the error by connecting to an IPv6 address, then I suspect this is because of a bug with address resolution potentially failing and causing an exception to be thrown in the background thread. You should actually be able to reach into the boost exception pointer to get the actual wrapped exception to see what the thrown error is.
I would think this is address resolution, or something to do with the actual HTTP handling.
At this point I would think this is working as intended, because the error was propagated as an exception and is something that you should be able to handle and recover from. Documentation on Boost.Exception should help with finding out what the exact exception is.
rhegner commentedon Oct 12, 2016
Thank you for your response!
I get the same exception with the IPv6 address.
The problem is that it is an unhandled exception. I don't end up in my catch block but instead the debugger breaks. So I don't see how I could handle and recover from this exception.
Here you can see the call stack at the time when the debugger breaks. And these are the locals at the current position of the call stack.
anonimal commentedon Oct 12, 2016
This issue reminds me of something similar in terms of not catching the exception. This related function is the only place where we use cpp-netlib for http handling (similar to the above sample).
Catching the calling block also has no effect.
LuminousCopper commentedon Oct 21, 2016
I think I'm running into something similar. I finally tracked it down to a std::exception_ptr being thrown directly. I had to do the following to get the true exception, which turned out to be an ssl system error. This is using the 0.13 branch.
anonimal commentedon Nov 13, 2016
@LuminousCopper great "catch" 😆
This is also an issue on Win32/64 for Kovri (also built against
0.13-release) when building on MSYS2/MinGW.Details (along with newly caught exception messages) in monero-project/kovri#453 apply to the patch presented above (as seen in monero-project/kovri#454).
Current clearnet HTTPS implementation here.
anonimal commentedon Dec 7, 2016
As just now opened in monero-project/kovri#490, this issue may also arise when connecting to servers with expired certificates. Can anyone else confirm?
Edit: JFTR, the exception:
anonimal commentedon Dec 8, 2016
As noted in monero-project/kovri#453 (comment), this issue also arose recently in arm64 (Linaro/Debian Jessie) with an openssl update
(I don't yet have the details on package versions or any related details)Edit: running version 1.1 (not producible when reverted back to 1.0.2j).Here was the exception (host and other details in monero-project/kovri#453):
deanberris commentedon Dec 15, 2016
Hi @anonimal -- is this something we can fix on the cpp-netlib side? Or is this something wrong with how ASIO is handling it? I'd appreciate a pull request to make this less of a problem for users.
anonimal commentedon Dec 15, 2016
Hi Dean, I don't know: I haven't looked deeper into the issue and, because of kovri-things, I won't be able to bug hunt anytime soon. I'll be happy to do that though when I can make the time to do so.
HighCommander4 commentedon Feb 11, 2018
That's a bug in cpp-netlib, for which I filed #815.
HighCommander4 commentedon Feb 14, 2018
I am experiencing the same "stream truncated" error that was mentioned above. Does anyone know of a solution other than downgrading libssl to 1.0.2?
HighCommander4 commentedon Aug 7, 2019
This is still a problem with latest trunk.
HighCommander4 commentedon Aug 8, 2019
Applying the Boost.Asio patch from this ticket resolves the problem for me.