Hi all, I’m a Java developer who wanted to get out of his comfort zone and I’m now doing .NET.
For our project we need to process 10.000.000 files (off course spread over multiple directories), we insert them in our write model (SQL server) and we also have a read model in ElasticSearch.
Hangfire to the rescue! It’s an awesome batchframework and so simple to use.
But, sometimes Hangfire just stops processing items (my current uneducated guess is DB locks). Is there a way to find out what is happening? It’s not memory (36MB when I restart it because it is not picking up new jobs) or CPU related (5%, it’s not doing anything anyway)
In java, I can create a Thread dump and start analyzing that one. In the .NET world I don’t know yet how to easily find out the issue. We already looked into process explorer but we’re unable to link the output (CLR) from process explorer to our debug symbols.
Help would be appreciated!
We’re using Hangfire 1.5.8 as a window service using Topshelf.
I debug my windows service in Visual Studio. If you build and install the service on your development system then you can start it and attach the debugger to it. You can do this with a service installer class. I usually put the install and uninstall commands in the pre and post build events and comment them out once the service is created for debugging; i.e.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u “$(TargetPath)”
and
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe “$(TargetPath)”
If this is a problem that occurs infrequently then you can write debug messages to the event log. I added a “debug” setting to my service that does this if I set it to true.
Hi all, thanks for the input.
We found the issue: one of the devs added a System.Diagnostics call for the DB with a Writer which was not thread safe.
Off course, this issue only happened when we were importing 10.000.000 items and thus is difficult to simulate locally. So, in the end I still would like to know how to do this.
Our service, cerated via Topshelf, is automatically deployed using Octopus deploy with a Release version.
@burningice we saw that stackoverflow post but we’re unable to attach the debug symbols created from Managed Stack Explorer to our code (CIL -> real code).
For now, we found our issue we had (using code reviews) but I still think we’ll need this in the future. I’ll give more info with examples the next time we’re struggling.
Thanks for the input from such an active and open community!