diff --git a/fairmq/ofi/Context.cxx b/fairmq/ofi/Context.cxx index d8db08f6..0c9544d6 100644 --- a/fairmq/ofi/Context.cxx +++ b/fairmq/ofi/Context.cxx @@ -47,9 +47,15 @@ auto Context::InitThreadPool(int numberIoThreads) -> void for (int i = 1; i <= numberIoThreads; ++i) { fThreadPool.emplace_back([&, i, numberIoThreads]{ - LOG(debug) << "OFI transport: I/O thread #" << i << " of " << numberIoThreads << " started"; - fIoContext.run(); - LOG(debug) << "OFI transport: I/O thread #" << i << " of " << numberIoThreads << " stopped"; + try { + LOG(debug) << "OFI transport: I/O thread #" << i << " of " << numberIoThreads << " started"; + fIoContext.run(); + LOG(debug) << "OFI transport: I/O thread #" << i << " of " << numberIoThreads << " stopped"; + } catch (const std::exception& e) { + LOG(error) << "OFI transport: Uncaught exception in I/O thread #" << i << ": " << e.what(); + } catch (...) { + LOG(error) << "OFI transport: Uncaught exception in I/O thread #" << i; + } }); } } diff --git a/fairmq/ofi/Socket.cxx b/fairmq/ofi/Socket.cxx index 5474dd86..882bc48a 100644 --- a/fairmq/ofi/Socket.cxx +++ b/fairmq/ofi/Socket.cxx @@ -138,11 +138,16 @@ catch (const SilentSocketError& e) // in case no connection could be established after trying a number of random ports from a range. return false; } -catch (const SocketError& e) +catch (const std::exception& e) { LOG(error) << "OFI transport: " << e.what(); return false; } +catch (...) +{ + LOG(error) << "OFI transport: Unknown exception in ofi::Socket::Bind"; + return false; +} auto Socket::BindControlEndpoint() -> void { @@ -212,6 +217,11 @@ catch (const std::exception& e) LOG(error) << "OFI transport: " << e.what(); return false; } +catch (...) +{ + LOG(error) << "OFI transport: Unknown exception in ofi::Socket::Connect"; + return false; +} auto Socket::ConnectEndpoint(std::unique_ptr& endpoint, Band type) -> void {