imranmomin / Hangfire.AzureCosmosDb

Azure Cosmos DB storage provider for Hangfire
https://www.hangfire.io/
MIT License
17 stars 16 forks source link

NullReferenceException when accessing succeeded or failed jobs page on dashboard #20

Closed vimception closed 2 years ago

vimception commented 3 years ago

At a certain point, the database seems to end up in a faulty state which results in NPE's being thrown when accessing the jobs pages (succeeded/failed...) on the Hangfire dashboard. The relevant stack trace is shown below.

It is unclear when this happens and why. I will investigate more and add details when available, but maybe this stack trace already rings a bell.

d": "0HMAD41QOKD09:00000058", "RequestPath": "/hangfire/jobs/succeeded", "SpanId": "dfc02e880345ac45", "TraceId": "e4d3a50513e8634f9dedfd7ddd626d9b", "ParentId": "0000000000000000", "ConnectionId": "0HMAD41QOKD09"}
System.NullReferenceException: Object reference not set to an instance of an object.
   at Hangfire.Azure.CosmosDbMonitoringApi.<>c.<SucceededJobs>b__14_0(State state, Job job)
   at Hangfire.Azure.CosmosDbMonitoringApi.<>c__DisplayClass17_0`1.<GetJobsOnState>b__4(Job job)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Hangfire.Azure.CosmosDbMonitoringApi.GetJobsOnState[T](String stateName, Int32 from, Int32 count, Func`3 selector)
   at Hangfire.Azure.CosmosDbMonitoringApi.SucceededJobs(Int32 from, Int32 count)
   at Hangfire.Dashboard.Pages.SucceededJobs.Execute()
   at Hangfire.Dashboard.RazorPage.TransformText(String body)
   at Hangfire.Dashboard.RazorPageDispatcher.Dispatch(DashboardContext context)
   at Hangfire.Dashboard.AspNetCoreDashboardMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)

Thanks.

imranmomin commented 3 years ago

Do you have more details