Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/11228.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a leaked aiodocker session in `DockerKernel.commit()` by scoping the client via `closing_async`.
5 changes: 1 addition & 4 deletions src/ai/backend/agent/docker/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ def _write_chunks(
try:
async with FileLock(path=lock_path, timeout=0.1, remove_when_unlock=True):
log.info("Container (k: {}) is being committed", kernel_id)
docker = Docker()
try:
async with closing_async(Docker()) as docker:
# There is a known issue at certain versions of Docker Engine
# which prevents container from being committed when request config body is empty
# https://github.com/moby/moby/issues/45543
Expand Down Expand Up @@ -289,8 +288,6 @@ def _write_chunks(
await write_task
finally:
await docker.images.delete(image_id)
finally:
await docker.close()
except TimeoutError:
log.warning("Session is already being committed.")

Expand Down
Loading