HangfireIO / HangfireIO/Hangfire

Jobs retry even when automatic retry is disabled if thread aborts due to error

Open
#1,071 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

We've had some cases where code in one of our jobs is causing the job's thread to abort either due to a OutOfMemoryException, StackOverflowException or in trying to debug this issue by explictity calling CurrentThread.Abort(). When this happens, even though we have `GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });` the jobs logs the following and repeatable attempts to retry the job until all threads have been killed.

`Error occurred during execution of 'Worker #8c566fd6' process. Execution will be retried (attempt 1 of 2147483647) in 00:00:01 seconds.`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing a job that aborts its thread while AutomaticRetryAttribute is configured with Attempts = 0, then trace the worker's retry decision after the abort. Done means the aborted job does not receive repeatable retries when automatic retry is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.