A job that ignores its cancellation token holds its worker forever

Open
#3,266 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp

Research direction

Read src/FluentCMS.Core/Jobs/JobExecutor.cs around lines 101 and 213, then inspect JobTimeoutTests.AJobThatIgnoresItsTokenStopsBeingRenewedAndIsTakenOverWhenItsLeaseLapses and compare the hand-off behavior in OutboxDrainer. Trace how attempt timeout and grace are handled; done means the acceptance cases pass and abandoned invocations are counted by a metric.

Written by the indexing model from the issue text.

Description

area:jobs type:bug

Problem

JobExecutor (src/FluentCMS.Core/Jobs/JobExecutor.cs:101,213) awaits the job's invocation directly. When the attempt timeout fires, the lease lapses and another worker takes the job, but the first worker stays in its await (see JobTimeoutTests.AJobThatIgnoresItsTokenStopsBeingRenewedAndIsTakenOverWhenItsLeaseLapses). Two such attempts stop the default queue (scheduled publish, retention, trash purge) on every instance until restart, and /health/ready reports Degraded only after 15 minutes. OutboxDrainer already hands off and waits with a limit.

Proposal

Run the invocation through a hand-off and WaitAsync(limit + grace); on time-out abandon it, settle the attempt as failed, free the worker, and count abandoned runs.

Acceptance

  • A job that ignores its token frees its worker after its limit plus grace
  • A metric counts abandoned invocations

Found in the code review of 17 Nov 2026 (B3).

Dominant language
C#
Stars
569
Forks
107
Avg merge
2h 49m
Merged PRs (30d)
397

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fluentcms/FluentCMS

All issues in fluentcms/FluentCMS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.