This article refers to legacy products, components or features. Therefore, the content in this article is offered "as is" and will no longer be updated. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.


When deleting a high volume of process instances using the workflow management API, the K2HostServer will show a huge increase in Windows handle usage (visible in Task Manager). This scenario will manifest itself until the server eventually terminates, sometimes producing an “Out of memory” exception.

Error Scenario

Note:This error scenario describes one set of circumstances under which this error is known to occur, and does not include all scenarios.

The code sample provided below can be used to start delete a high volume of process instances. Despite the code explicitly closing and disposing the Management Server Connection, the handle count increases.

Note:This code may cause your K2 Server to stop responding and may require a restart. Caution must be exercised if this code is tested on production systems.
WFM.WorkflowManagementServer wms = new WFM.WorkflowManagementServer("localhost",
WFM.ProcessSets procset = wms.GetProcSets();
int procid = 0;
foreach (WFM.ProcessSet procs in procset)
if (procs.FullName.ToString() == "ClientProcess\\Process1")
procid = procs.ProcID;
WFM.ProcessInstances pi = wms.GetProcessInstances(procid);
foreach (WFM.ProcessInstance var in pi)
wms.DeleteProcessInstances(var.ID, true);
catch (Exception)

Error Resolution

This Hotfix is contained within the latest K2 blackpearl Update. Install the update package to resolve the error.

Note:Once the hotfix has been installed, the K2 blackpearl Service instance and or an IIS Reset may be required.

The latest K2 blackpearl Update is available as an independent installation package which can be found here: http://portal.k2.com/downloads/bp/Default.aspx