Symptoms
Assume that you have some processes which have Status = 0 (Error) in ProcInst table but seemingly not visible anywhere in GUI (K2 Workspace).
Does it necessary to do something about such processes?
Is it necessary to reanimate(move to some other status)/retry them? If not what is the meaning of this status and why amount of processes in such status can grow in K2 DB.
Diagnoses
If process instance are in error state but they are not visible in Workspace it means that something went wrong at some point and exact reproduction steps are necessary to investigate this further. It can have something to do with IPC processes, mail events or notification or escalation emails that fail. Just as an example of potential issue/what can go wrong:
In certain scenarios when an escalation causes a worklist item to go into error state, it disappears from the users' worklist, but not from the Management Worklist. Reproduction steps:
1. Create a process with a Client Event
2. Set an Activity Escalation to send an email after 5 seconds
3. Delete or modify the connection strings so that the email escalation will fail
4. Start a new process instance
5. It will go into an error state after a while
6. Check the error profiles, it will appear there
7. Check the management console worklist, it still remains there
This is probably not a scenario for the client's case but it is not possible to guess what exactly can go wrong to cause the situation when process instances are in error state, and they are not visible in Workspace with no details there.
If there was no weird issues then normally it is necessary to confirm in what exact table you can see such instances? Is it Serverlog.ProcInst, or Server.ProcInst?
If it is in only in ServerLog.ProcInst, it means the processes were already deleted but the log data for them have been kept – In this case there is nothing to be done.
If it is in Server.ProcInst, then it must also show under the relevant process instances node in Workspace Management Console.
The error status is there to halt the process instance when an error occurs that prevents the process to continue normally without intervention. There are a number of things you can do:
1. Retry the error in Error Profiles.
A process instance in error state should have a correlating error log entry in error profiles that can be retried.
Retrying an error only works if the error condition was temporary – i.e. a server that was offline, or a server that was too busy at the time of execution etc. The error message should give some indication as to what was wrong and if it was something that could have been temporary.
If the conditions haven't changed when retrying the error, the process instance will go into error state again and a new error log entry will be available.
2. Repair the process and process instance.
In visual studio, if you open K2 Process Management, you can open the process instance in error state and fix it. This is only if there was something wrong in the process' design that caused the error. When repairing it, it deploys a new process version and retries the process instance on the new version.
This isn't always an option as the problem could lie in a data field value which wouldn't be updated when redeploying the process. Instead of repairing the process instance, you can also retry it on a newer version of the process – Obviously it will only work if the new process version fixed the flaw that caused the error.
3. Perform a GOTO Activity.
This will take the process instance out of error state, expire all active activities and go to the specified activity. This is also not always an option due to parallel execution paths etc.
4. Delete the process instance if it no longer has any value and no need to continue.
Resolution
See DIAGNOSIS section.