Restart HR.Net services

HR.Net is full of WTF moments. This whole blog is based on these moments: from ancient version of jQuery to obscure bugs in places where “things should just work”.

This time I run into Workflow service that sometimes gets stuck: the actual windows service gets hanged and stop responding and processing any new workflows. But the whole system heavily depends on workflows being processed in a timely manner, the system just crashes and I have a lot of unhappy customers calling me in panic. The fix is simple – restart the workflow service. Though the fix does not show signs of life – it works. HR.Net queues workflows in a table and the service picks up one workflow at a time and runs it. Usually by the time I get a phone call there are hundreds of unprocessed workflows already and the service needs some time to crunch through them. This bit of SQL will show you how many workflow instances are there

select count(*) from OC_WORKFLOWINSTANCES
where STARTEDDATETIME > '2017-07-10 00:00:00.000'

replace the date with your current date to show how many have been queued during your day.

Solution to this problem is to restart HR.Net Workflow Service regularly. Do this via commands:

net stop "HR.net Workflow Service"
net Start "HR.net Workflow Service"

Put this as a scheduled task and be done with this. I’ve scheduled this command to be executed every hour, but I suggest you start from every 24 hours. I already had HR.Net Reports service restarted every hour because it caused problems too. And I’ve included workflow service there as well to save myself some typing -)

So my whole bat file looks like this:

@@ECHO OFF

ECHO ***STOPPING HR.NET SERVICES***
net stop "HR.net Reports Service"
net stop "HR.net Workflow Service"

ECHO ***STARTING HR.NET SERVICES***
net Start "HR.net Reports Service"
net Start "HR.net Workflow Service"

EXIT
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

4 Responses to Restart HR.Net services

Leave a Reply

Your email address will not be published. Required fields are marked *