Skip to content

fix(scheduler): reclaim orphaned thread claims (unblock prod hot-loop, fixes #1559)#1563

Open
bingran-you wants to merge 1 commit intodevfrom
bry/reclaim-orphan-thread-claims
Open

fix(scheduler): reclaim orphaned thread claims (unblock prod hot-loop, fixes #1559)#1563
bingran-you wants to merge 1 commit intodevfrom
bry/reclaim-orphan-thread-claims

Conversation

@bingran-you
Copy link
Copy Markdown
Contributor

Summary

Why this is urgent

Prod (commit 214cfd9) has been wedged since 2026-04-23 01:08 UTC. Two concrete user-facing impacts:

  • Email reply to shuangshuang329@gmail.com (task b0359ed4) stuck ≈28h.
  • Email reply to 1441903771@qq.com (EAP essay, task 35b9d323) stuck ≈4h.
    Plus 33 other deferred-but-never-executed tasks across 15+ users.

What the patch does

scheduler_module/src/service/scheduler.rs:

  • Adds try_reclaim_orphaned_thread_claim that, when a claim is refused as "thread busy", checks whether the claim's task has any matching running row in task_executions. If not, the entry is dropped from running_threads and the slot is reclaimed.
  • Wires reclaim attempts into claim_thread_execution_slot so the hot-loop self-heals within a tick instead of wedging forever.

Test plan

  • cargo build -p scheduler_module --release green
  • Once merged, deploy to prod and confirm found N due task(s) followed by executing (not deferred) for most tasks within one tick
  • Watch task_executions running count on prod return to near-zero once legitimate ACI runs finish

Follow-ups (not part of this PR)

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dowhiz Ready Ready Preview, Comment Apr 23, 2026 2:23am

@bingran-you bingran-you added breeze:wip Breeze is actively working on this item breeze:done Breeze finished handling this item and removed breeze:wip Breeze is actively working on this item labels Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breeze:done Breeze finished handling this item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant