HangfireIO / HangfireIO/Hangfire
100% CPU after completing a recurring job
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
Hi,
We use Hangfire 1.7.27 + Hagfire.Pro 2.3.0.0 + Hagfire.Pro.Redis 2.8.12.0
We are facing 100% CPU usage while hangfire is not processing any jobs after completing a recurring job

How does this happen:
1. If restart the IIS then CPU load is 1-2%
2. If the only recurring job will be executed at least once then CPU load is 98-99% and does not decrease for a long time
I've collected trace at this moment on the server using dotTrace

RunWorkLoop in DedicatedThreadPoolPipeScheduler takes 50% time
Wait in CancellationTokenExtentions takes 20% time
This is RunWorkLoop code
https://github.com/mgravell/Pipelines.Sockets.Unofficial/blob/19b141f30fe2485dd79993be0ac87a9fc6b34b74/src/Pipelines.Sockets.Unofficial/DedicatedThreadPoolPipeScheduler.cs#L166
Contributor guide
Research direction
Start with the linked DedicatedThreadPoolPipeScheduler.cs RunWorkLoop implementation and the dotTrace evidence described in the issue. Reproduce the recurring-job sequence after an IIS restart using Hangfire 1.7.27, Hangfire.Pro 2.3.0.0, and Hangfire.Pro.Redis 2.8.12.0. Done means the recurring job completes without leaving Hangfire at sustained 98–99% CPU.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, redis
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100