main: make sure view_builder doesn't propagate semaphore errors

Stopping services which occurs in a destructor of deferred_action
should not throw, or it will end the program with
terminate(). View builder breaks a semaphore during its shutdown,
which results in propagating a broken_semaphore exception,
which in turn results in throwing an exception during stop().get().
In order to fix that issue, semaphore exceptions are explicitly
ignored, since they're expected to appear during shutdown.

Fixes #4875
This commit is contained in:
Piotr Sarna
2019-08-30 13:30:14 +02:00
committed by Nadav Har'El
parent c8f8a9450f
commit 23c891923e

View File

@@ -1164,6 +1164,10 @@ future<> view_builder::stop() {
return _sem.wait().then([this] {
_sem.broken();
return _build_step.join();
}).handle_exception_type([] (const broken_semaphore&) {
// ignored
}).handle_exception_type([] (const semaphore_timed_out&) {
// ignored
});
});
}