From 2aceca41fbe6c9a9e5010fabc46cd8f5ad8904c2 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 4 Sep 2024 14:11:51 +0200 Subject: [PATCH] fix: Workaround CancelledError on windows (#581) --- src/gallia/command/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallia/command/base.py b/src/gallia/command/base.py index c12187b55..6fbba3407 100644 --- a/src/gallia/command/base.py +++ b/src/gallia/command/base.py @@ -334,8 +334,14 @@ async def _db_finish_run_meta(self) -> None: try: await self.db_handler.disconnect() + # CancelledError appears only on windows; it is unclear why this happens… except Exception as e: logger.error(f"Could not close the database connection properly: {e!r}") + except asyncio.exceptions.CancelledError as e: + logger.error(f"BUG: {e!r} occured. This only seems to happen on windows") + logger.error( + "If you can reproduce this, open an issue: https://github.com/Fraunhofer-AISEC/gallia" + ) def _dump_environment(self, path: Path) -> None: environ = cast(dict[str, str], os.environ)