Thursday, June 23, 2016

Releasing K2 Running Processes

Several times, especially in dev environment some of the processes stuck in running mode. It might be the infinite loop you coded or any glitch from the server.
When you try to stop or delete them from the workspace, workspace keeps spinning till death. It keeps eating up the processor and slows down the server, how to get rid of these process?

First, try to restring the K2 service hoping the running processes unstuck. Most of the times it doesn't work and you need to follow below steps.

Stop the K2 host service.

Go to the K2 database. K2 recommends not to touch their database, but in this case, I don’t see any other option.

You can find running processes with below query. We are on 6.7.11 version of K2.
SELECT * FROM [K2].[Server].[ProcInst] where Status = 1 

Here is a link which explains the K2 database ERD diagram. 

On the bottom of the pdf, there is an explanation of several flags used in the database. I found this pdf very useful while custom development.
Below are Process Status flags and its explanation.

Run below query for each running process to delete the process. You can also set the process status to stop them, in my case, It did not work and anyway, these are the faulty process and you would want to get rid of them.
Update [K2].[Server].[ProcInst] set status= 1 where ProcID =1234 and ID=5678

Wow, now it is working like a charm. The server went back to its normal status.

No comments:

Post a Comment