diff --git a/libervia/backend/core/launcher.py b/libervia/backend/core/launcher.py index c8e83b0a..7bb2f6d1 100644 --- a/libervia/backend/core/launcher.py +++ b/libervia/backend/core/launcher.py @@ -312,10 +312,16 @@ class Launcher: runner.run() if runner._exitSignal is not None: app._exitWithSignal(runner._exitSignal) + # FIXME: The loop is not closing correctly as soon as + # libervia.backend.tools.utils.aio decoractor is used. Asyncio loop doesn't + # seem to have any task left, and reactor is stopped, but there is still + # something preventing proper exit. `os._exit` is not great, but currently + # the way to actually close the backend in this case. This needs further + # investigation. try: - sys.exit(app._exit_code) + os._exit(app._exit_code) except AttributeError: - pass + os._exit(C.EXIT_ERROR) @classmethod def run(cls): diff --git a/libervia/backend/core/main.py b/libervia/backend/core/main.py index f475d7cb..c8cf7221 100644 --- a/libervia/backend/core/main.py +++ b/libervia/backend/core/main.py @@ -284,9 +284,11 @@ class LiberviaBackend(service.Service): f"Configuration error, please check and fix your configuration: {e}" ) self.stop(exit_code=C.EXIT_BAD_ARG) + return except Exception: log.exception(f"Could not initialize backend") self.stop(exit_code=C.EXIT_ERROR) + return self._add_base_menus() self.init_pre_script.callback(None)