HangfireIO / HangfireIO/Hangfire

Hangfire: Cannot insert duplicate key in object 'HangFire.Counter'

Open
#1,672 3 comments 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

I was using a single deployment/server previously, Now aster shifting to an IIS Cluster with three servers, getting this exception a lot, jobs are not completing.

Violation of PRIMARY KEY constraint 'PK_Counter'. Cannot insert duplicate key in object 'HangFire.Counter'. The duplicate key value is (stats: succeeded).

Using: hangfire 1.7.9

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by reproducing the duplicate-key exception with the three-server IIS deployment and inspect the Hangfire counter persistence path and the reported stats:succeeded key. Done means clustered processing no longer produces the exception and jobs complete reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.