asio
asio copied to clipboard
asio::ip::tcp::resolver resolve function crashes program if exception is thrown
int main() {
asio::io_context context;
try {
asio::ip::tcp::resolver resolver(context);
auto endpoints = resolver.resolve("a", "10");
} catch (std::exception& e) {
std::cerr << "Client Exception: " << e.what() << "\n";
}
}
This simple code causes a crash.
make: *** [run] Trace/BPT trap: 5
When I remove the try catch, the exceptions seems to function normally
libc++abi: terminating due to uncaught exception of type std::__1::system_error: resolve: Host not found (authoritative)
make: *** [run] Abort trap: 6
Tested on: asio main and 1-29-0 Clang and Apple Clang macOS 14.2.1
Edit: I think this might be an mac m1 problem. I keep getting this problem when trying to throw exceptions elsewhere too.