Skip to content

A job that says running after its process died - #22

Merged
ralyodio merged 1 commit into
masterfrom
recover-jobs
Aug 10, 2026
Merged

A job that says running after its process died#22
ralyodio merged 1 commit into
masterfrom
recover-jobs

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Do not merge this while a detection run is in progress — merging deploys, and deploying kills the run. That is the bug, not a side effect of the fix.

What happened on your server

job_f4dfcd49   running   detection   last log 06:50:32   8050 of 9000 frames

That is a thorough pass killed 950 frames from the end when the #21 deploy replaced the container. It still says running. It will say running for ever.

In the panel that is indistinguishable from a slow run: the progress just stops advancing, which is also what a ten-minute pass looks like from the outside.

The fix

Analysis runs inside the web process, so at startup this process owns no running work by definition. Anything the database still calls running was interrupted and nothing is coming to finish it.

Those rows are failed with a reason, and the reason goes to the job log — where the person who started it is looking, rather than the server's stderr. Queued rows go the same way, since nothing picks those up either.

Finished work is untouched, including jobs that already failed for their own reasons: the sweep must not overwrite why something actually broke.

Found by writing the test

The first version updated updated_at. The jobs table has no such column — it has finished_at. That would have thrown on every boot that found an interrupted job, which is exactly the boot where it matters.

The deeper problem, not fixed here

Every deploy kills any running analysis. Tonight that cost you a run at 8050/9000. This PR makes the loss visible; it does not prevent it. Doing that properly means detection surviving the web process — a separate worker, or resumable jobs that pick up from the last completed frame. Worth doing, and worth its own change rather than being smuggled into this one.

Verification

464 tests pass (4 new), lint and typecheck clean.

Analysis runs inside the web process, so a deploy replaces the container and
takes the work with it. The row keeps saying running for ever. Observed
tonight: a thorough detection pass killed at frame 8050 of 9000 by a deploy,
still reporting running twenty minutes later, indistinguishable in the panel
from one still going — the progress simply stops advancing, which is also what
a slow pass looks like.

At startup this process owns no running work by definition, so anything the
database still calls running was interrupted and nothing is coming to finish
it. Those rows are failed with a reason, and the reason is written to the job
log where the person who started it is looking. Queued rows go the same way:
nothing picks them up either.

Finished work is left alone, including jobs that already failed for their own
reasons — the sweep must not overwrite why something actually broke.

Writing the test found the bug in the first version of this: it updated
updated_at, which the jobs table does not have. That would have thrown on
every boot with any interrupted job present.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit fcab77c into master Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant