From 16a38f397921b219fff21dc5296a1c143280b89f Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Wed, 29 Jun 2016 18:15:14 -0700 Subject: [PATCH] Catch unhandled exceptions in I/O service threads (RIPD-1166) --- src/ripple/app/main/BasicApp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ripple/app/main/BasicApp.cpp b/src/ripple/app/main/BasicApp.cpp index a728e0da0..5a25fdbaa 100644 --- a/src/ripple/app/main/BasicApp.cpp +++ b/src/ripple/app/main/BasicApp.cpp @@ -20,6 +20,7 @@ #include #include #include +#include BasicApp::BasicApp(std::size_t numberOfThreads) { @@ -27,11 +28,15 @@ BasicApp::BasicApp(std::size_t numberOfThreads) threads_.reserve(numberOfThreads); while(numberOfThreads--) threads_.emplace_back( - [this, numberOfThreads](){ + [this, numberOfThreads]() + { beast::Thread::setCurrentThreadName( std::string("io_service #") + std::to_string(numberOfThreads)); - this->io_service_.run(); + + ripple::reportUncaughtException (&io_service_, + &boost::asio::io_service::run, + "io_service::run"); }); }