HangfireIO / HangfireIO/Hangfire

NullReferenceException at Hangfire.SqlServer.SqlServerJobQueue.DequeueUsingTransaction

Open
#1,680 4 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 am using version 1.7.4. Since few weeks I have sometimes error:

> Error","State":"Execution Worker is in the Failed state now due to an exception, execution will be retried no
more than in 00:00:04","eType":1104711256,"thread":38,"srcCtx":"Hangfire.Processing.BackgroundExecution","error":"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at System.Data.SqlClient.
SqlInternalTransaction.Rollback()\r\n at System.Data.SqlClient.SqlTransaction.Dispose(Boolean disposing)\r\n at Hangfire.SqlServer.SqlServerJobQueue.DequeueUsingTransaction(String[]
queues, CancellationToken cancellationToken)\r\n at Hangfire.SqlServer.SqlServerJobQueue.Dequeue(String[] queues, CancellationToken cancellationToken)\r\n at Hangfire.SqlServer.
SqlServerConnection.FetchNextJob(String[] queues, CancellationToken cancellationToken)\r\n at Hangfire.Server.Worker.Execute(BackgroundProcessContext context)\r\n at Hangfire.Server.
BackgroundProcessDispatcherBuilder.ExecuteProcess(Guid executionId, Object state)\r\n at Hangfire.Processing.BackgroundExecution.Run(Action`2 callback, Object state)","errorHash":
4130264238}

Contributor guide

Open the contributing guide

Research direction

Start with the reported stack trace in Hangfire.SqlServer.SqlServerJobQueue.DequeueUsingTransaction and the version 1.7.4 behavior. Investigate the transaction rollback and disposal path shown in the trace, then establish a reproducible case or regression test; done means the worker no longer fails with this NullReferenceException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, database
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.