1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-02-14 23:19:37 +00:00

Handle order issues in job progress updates during image pulls (#6513)

Catch ValueError exceptions with "Cannot update a job that is done"
during image pull progress updates. This error occurs intermittently
when progress events arrive after a job has completed. It is not clear
why this happens, maybe the job gets prematurely marked as done or
the pull events arrive in a different order than expected.

Rather than failing the entire pull operation, we now:
- Log a warning with context (layer ID, status, progress)
- Send the error to Sentry for tracking and investigation
- Continue with the pull operation

This prevents pull failures while gathering information to help
identify and fix the root cause of the race condition.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2026-01-30 23:06:53 +01:00
committed by GitHub
parent 3db60170aa
commit 96d0593af2

View File

@@ -391,6 +391,21 @@ class DockerInterface(JobGroup, ABC):
# Send all these to sentry. Missing a few progress updates
# shouldn't matter to users but matters to us
await async_capture_exception(err)
except ValueError as err:
# Catch "Cannot update a job that is done" errors which occur under
# some not clearly understood combination of events. Log with context
# and send to Sentry to track frequency and gather debugging info.
if "Cannot update a job that is done" in str(err):
_LOGGER.warning(
"Unexpected job state during pull: %s (layer: %s, status: %s, progress: %s)",
err,
reference.id,
reference.status,
reference.progress,
)
await async_capture_exception(err)
else:
raise
listener = self.sys_bus.register_event(
BusEvent.DOCKER_IMAGE_PULL_UPDATE, process_pull_image_log