fix: resume processing automatically after container restart#18
Open
martindell wants to merge 1 commit intoSpaceinvaderOne:mainfrom
Open
fix: resume processing automatically after container restart#18martindell wants to merge 1 commit intoSpaceinvaderOne:mainfrom
martindell wants to merge 1 commit intoSpaceinvaderOne:mainfrom
Conversation
Two bugs combined to cause processing to stall permanently after any container restart: 1. Images left in 'processing' status from an unclean shutdown were never recovered, permanently blocking the worker queue. 2. The worker queue is in-memory only — existing 'pending' items in the database were never re-enqueued on startup, so processing never resumed without manual user intervention. Fix: add two startup recovery steps in lifespan(): - Reset any stuck 'processing' images back to 'pending' immediately after DB init. - Re-enqueue all 'pending' images immediately after the worker starts. Both are single SQL queries, cheap at startup, and no-ops on a clean first run.
|
Nice! Thanks for working this out @martindell. I made the changes inside the container, rebooted and it is now processing again. Only 89717 XMP descriptions to go! :D Edit: A second reboot removed my patch, so I ended up adding the main.py on my Unraid server in appdata and adding another path to the container replacing the main.py inside the container, with the patched version from appdata. Now it works like a charm through reboots. Thanks again! |
|
Thanks @martindell, worked great for a stuck process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After a container restart (whether from a crash, manual restart, or Unraid maintenance), a-eye silently stalls and never resumes processing. Two separate bugs combine to cause this:
Bug 1 - Stuck "processing" items block the queue
If the container stops while images are being processed, those images are left in
status = 'processing'in the database permanently. On the next startup, these items are never recovered, permanently blocking the worker queue.Bug 2 - Pending items are never re-enqueued
The worker queue is in-memory only. On startup it is always empty, regardless of how many
status = 'pending'items exist in the database. There is no mechanism to reload them — meaning after any restart, processing simply never resumes unless the user manually triggers it through the UI (and knows they need to).In practice both bugs together mean: restart the container → processing stops forever with no error message.
Fix
Two small additions to the startup
lifespan()function inbackend/main.py:processingitems back topending, with a log message counting how many were recovered.pendingitems from the database into the worker queue, with a log message counting how many were enqueued.Both operations are cheap (single SQL query each), happen at startup only, and are no-ops on a clean first run.
Testing