mirror of
https://github.com/usestrix/strix.git
synced 2026-08-16 09:26:39 +02:00
fix(runtime): close the docker client on session cleanup (#787)
This commit is contained in:
@@ -167,11 +167,19 @@ async def cleanup(scan_id: str) -> None:
|
|||||||
except Exception: # noqa: BLE001
|
except Exception: # noqa: BLE001
|
||||||
logger.debug("cleanup(%s): caido_client.aclose() raised", scan_id, exc_info=True)
|
logger.debug("cleanup(%s): caido_client.aclose() raised", scan_id, exc_info=True)
|
||||||
|
|
||||||
|
client = bundle["client"]
|
||||||
try:
|
try:
|
||||||
await bundle["client"].delete(bundle["session"])
|
await client.delete(bundle["session"])
|
||||||
logger.info("Cleaned up sandbox session for scan %s", scan_id)
|
logger.info("Cleaned up sandbox session for scan %s", scan_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"cleanup(%s): client.delete raised; container may need manual reaping",
|
"cleanup(%s): client.delete raised; container may need manual reaping",
|
||||||
scan_id,
|
scan_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
docker_client = getattr(client, "docker_client", None)
|
||||||
|
if docker_client is not None:
|
||||||
|
try:
|
||||||
|
docker_client.close()
|
||||||
|
except Exception: # noqa: BLE001
|
||||||
|
logger.debug("cleanup(%s): docker_client.close() raised", scan_id, exc_info=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user