Recover jobs left InProgress when a node dies, without Redis

Abierto
#47 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, mongodb, redis

Línea de trabajo

Start with how a node releases its own rows in src/TickerNet.EntityFrameworkCore/DependencyInjection/ServiceExtension.cs, then read NodeHeartBeatBackgroundService and ReleaseDeadNodeResources for the Redis path, and the row-claiming loop in src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.cs. Done means a lease (LockedAt) is renewed while a job runs, a stale lease can be taken over without Redis, and late writes from a lost lease are rejected, across EF Core, MongoDB, Redis and in-memory providers. This needs an ADR in site/decisions/ before code.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

.NET enhancement roadmap

What happens

A job is marked InProgress with a LockHolder when a node starts it. If that node dies, the row stays InProgress until something releases it, and there are only two ways that happens:

  • With Redis, NodeHeartBeatBackgroundService notices the missing heartbeat and calls ReleaseDeadNodeResources for the dead node.
  • Without Redis, a node only releases its own rows when it starts again with the same NodeIdentifier (src/TickerNet.EntityFrameworkCore/DependencyInjection/ServiceExtension.cs). NodeIdentifier defaults to the machine name, which changes for every container or pod, so in most deployments the rows are never released.

Release also has a single outcome: the row goes back to Idle and runs again. A job that hangs on a live node is never released at all.

Separately, the scheduler marks every row it fetches as InProgress before it waits for a free worker slot (src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.cs), so with a low MaxConcurrency many rows sit InProgress without running, and all of them are stranded if the node dies.

Expected

  • Work held by a node that's gone is recovered without Redis, based on time: for example the node renews a lease (LockedAt) while it runs the job, and any node may take over a row whose lease is older than a configurable timeout.
  • A per-function (or global) choice of what recovery does: run it again, or mark it failed. Jobs that aren't safe to repeat need the second.
  • An optional execution timeout that cancels a job running longer than allowed.

Notes

  • Mark a row InProgress only when a worker slot is taken; until then it stays claimed but not started.

  • Touches every provider: EF Core (BasePersistenceProvider), MongoDB, Redis and the in-memory provider.

  • Lease renewal must not run more often than needed; one update per running job every few seconds is the order of magnitude to aim for.

  • Late writes from a node that lost its lease must be rejected, so a recovered job isn't finished twice.


Part of the TickerQ comparison roadmap. Design it from this description only: never read or copy code, tests or docs from TickerQ 10.5.0 or later, which is under a commercial license (see CONTRIBUTING.md). If it adds or changes public API, add an ADR in site/decisions/ and list the API in the pull request. Comment here if you'd like to pick it up, and ask anything in Discussions.

Lenguaje dominante
C#
Estrellas
0
Forks
2
Merge medio
1 h 8 min
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TickerNet/TickerNet

Todos los issues de TickerNet/TickerNet

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.