You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a related issue with same title on the main Hangfire project's issues tracker, but I believe I've isolated this to being an issue with use of the 'InMemory' storage provider so I'm creating an issue here since this may be the more appropriate place to pursue it.
On digging into the InMemory provider's code, I was looking for anywhere that had 'static' state management in use. As mentioned on the related issue #2082 above, when running the tests individually 1-by-1 they all work and pass their assertions that verify the job was triggered/executed. When I switched to using a local SQL Server database as the storage provider, they all pass. So now I'm fairly convinced it's due to this provider and something internal to it that relates to the lifetime of the AppDomain running the tests.
What I do see is that in the [InMemoryDispatcherBase] class there is some static state being managed that relates to the queues and it looked at least suspect to what I'm seeing - jobs not getting picked up & executed.
Additionally, that component is called as part of acquiring a distributed lock in the [InMemoryConnection] class which has the following note on it:
// TODO: Track acquired lock at a connection level and release them on dispose
That too leads me to suspect that static state management might be a factor in the issue I'm chasing.
Questions
Is there a way (exposed to consumers) to force a 'reset' of all state?
If no facility for this exists today, can we get something like that? i.e. InMemoryStorage.Reset() or something exposed on the InMemoryStorageOptions like an options.ForceReset = true or similar.
Is there any other trickery I could consider to work around this?
The text was updated successfully, but these errors were encountered:
I created a related issue with same title on the main Hangfire project's issues tracker, but I believe I've isolated this to being an issue with use of the 'InMemory' storage provider so I'm creating an issue here since this may be the more appropriate place to pursue it.
See: HangfireIO/Hangfire#2082
My Research So Far
On digging into the InMemory provider's code, I was looking for anywhere that had 'static' state management in use. As mentioned on the related issue #2082 above, when running the tests individually 1-by-1 they all work and pass their assertions that verify the job was triggered/executed. When I switched to using a local SQL Server database as the storage provider, they all pass. So now I'm fairly convinced it's due to this provider and something internal to it that relates to the lifetime of the AppDomain running the tests.
What I do see is that in the [InMemoryDispatcherBase] class there is some static state being managed that relates to the queues and it looked at least suspect to what I'm seeing - jobs not getting picked up & executed.
Additionally, that component is called as part of acquiring a distributed lock in the [InMemoryConnection] class which has the following note on it:
// TODO: Track acquired lock at a connection level and release them on dispose
That too leads me to suspect that static state management might be a factor in the issue I'm chasing.
Questions
The text was updated successfully, but these errors were encountered: