2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[#3112] catch all exception when running IOService run, run_one and poll

This commit is contained in:
Razvan Becheriu
2023-10-30 21:24:50 +02:00
parent 681293f807
commit 33f06d0ffa
2 changed files with 26 additions and 5 deletions

View File

@@ -164,7 +164,12 @@ IoServiceThreadPool::setState(State state) {
case State::PAUSED: {
// Stop IOService.
if (!io_service_->stopped()) {
io_service_->poll();
try {
io_service_->poll();
} catch (...) {
// Catch all exceptions.
// Logging is not available.
}
io_service_->stop();
}
@@ -180,7 +185,12 @@ IoServiceThreadPool::setState(State state) {
case State::STOPPED: {
// Stop IOService.
if (!io_service_->stopped()) {
io_service_->poll();
try {
io_service_->poll();
} catch (...) {
// Catch all exceptions.
// Logging is not available.
}
io_service_->stop();
}
@@ -215,8 +225,13 @@ IoServiceThreadPool::threadWork() {
}
}
// Run the IOService.
io_service_->run();
try {
// Run the IOService.
io_service_->run();
} catch (...) {
// Catch all exceptions.
// Logging is not available.
}
{
std::unique_lock<std::mutex> lck(mutex_);

View File

@@ -837,7 +837,13 @@ DControllerBase::~DControllerBase() {
}
io_signal_set_.reset();
getIOService()->poll();
try {
getIOService()->poll();
} catch (...) {
// Don't want to throw exceptions from the destructor. The process
// is shutting down anyway.
;
}
}
std::string