Stop a running Process

  • 10 February 2015
  • 3 replies
  • 340 views



 

Symptoms

 


Process is on a loop and can't be stopped.
 

 

Diagnoses

 


I created a server event with custom code in a K2 Process. The process was throwing an error, so I wanted to debug the process. I added an infinite sleep loop in the process, with the intention of attaching to the process and then stepping passed the loop in the process. When I tried to attach to the process, the code would not "hit" the breakpoint. Therefore the process is stuck in the infinite loop.

I then tried to go to workspace and stop the process. Workspace was unable to stop the process.
I then tried turning the server off, and turning it back on. Then I went into workspace and tried to stop the process. This did not work.

How can I stop this process from using the server's resources?

 

 

Resolution

The way to stop a process that is on a loop or stuck is thru the database. These are the steps on how to do it.

1. Stop the K2 Service

2. Identify the running instances:

Status = 1 (Running)
Status = 4 (Stopped)

Consolidated DB = SELECT * FROM [K2].[Server].[ProcInst] where Status = 1 
Multiple DB's = SELECT * FROM [K2Server].[dbo].[_ProcInst] where Status = 1 

3. Identify the instance by start time or Folio and change the status to 4 to stop it:

Consolidated DB = Update [K2].[Server].[ProcInst] set status= 4 where ID = 1234 and ProcID =1234
Multiple DB's = Update [K2Server].[dbo].[_ProcInst] set status= 4 where ID = 1234 and ProcID =1234

4. Start the K2 Service.

 

 



 

3 replies

Badge +3

In the case where I ran into this situation, I found that the process instance that appeared to be stuck in state "Running" (according to K2 Workspace) had a Status value of 1, not 2. This was in Blackpearl 4.6.11 . 

I have just run into same situation and like jrwarwick our process had a Status of 1, not 2 AND even though the update script says "1 row affected" we could not update the Status field.

We are running Blackpearl 4.7

 

Badge +2

Hi,

 

In my case where I programmatically stopped processes in the database it was important to update both the Sever and ServerLog schema, it looks to me that K2 does a comparison on the process instances in both schemas and then updates the Sever schema.

 

Kind regards,

 

H Wagener

Reply