This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

There appears to be poor performance within the K2 Environment. This could include but is not limited to:

  1. Smartforms take an extended period of time to load, or time out.
  2. Extended wait times on searches within K2 Management or Workspace.
  3. SQL appears to be under high resource usage.

* Please be aware that performance issues vary from each environment and can have a multitude of factors. If you see the above behavior it is possible this resolution will not provide a solution. This is not a global resolution for performance issues, don't hesitate to submit a support ticket if you are seeing performance issues related to K2.

Symptoms

Some roles might have been deleted which were set to be dynamic within K2. When navigating to K2 Management or K2 Workspace (Legacy), a role will show here: Workflow Server > Workflows > [Project Name] > Workflow > Roles.

However, when looking for that same role within Management or Workspace under Users > Roles (Management Console > Roles for K2 Workspace), the role does not exist here as it was previously deleted.

Within the K2 Host Server Logs you will see a large amount of the following errors relating to an empty queue:

""42335799","2017-07-31 14:19:14","Error","General","24148","UMEmptyQError","K2DestQueue.RunDestQueue","24148 The User Manager 127.0.0.1 returned an empty queue.","anonymous","0.0.0.0","DEVSERVER:C:\Program Files (x86)\K2 blackpearl\Host Server\Bin","42335799","2b30a424f949470eb0b022a7a59cc5bc","""

Additionally, some deadlock errors may appear as well:

"43879730","2017-08-01 19:33:45","Error","General","1","GeneralErrorMessage","K2Sql.Log","1 Transaction (Process ID 56) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.","","","DEVSERVER:C:\Program Files (x86)\K2 blackpearl\Host Server\Bin","43879730","65b4eef65b6b4b58824d0f780389da4d",""

Resolution

This behavior is caused by deleting a role, but its dependencies were not cleared out from the K2 Database. Specifically, there are still entries within the Server.DestQueue table for roles tied to processes that may or may not exist. 

Alleviate this behavior by deleting the entries from this Server.DestQueue table.

Additionally, the Server.DestQueueUser table can have references to the role item we have in Server.DestQueue that needs to be deleted. To check for any entries in these tables that might need to be cleaned up, you can run the below Queries depending on your scenario:

/** Query to return all values from DestQueueUser table **/

SELECT * FROM [Server].[DestQueueUser]

/** Query to get contents of DestQueue table **/

SELECT * FROM [Server].[DestQueue]

/** Use this query if there is a specific role you want to focus on and find what tie ins exist on the DestQueueUser table. Give @rolename a value for the role name in question **/

DECLARE @rolename nvarchar(250)

SET @rolename = N'[ROLE NAME HERE]'

SELECT * FROM [Server].[DestQueueUser]

WHERE QueueID = (SELECT ID FROM [Server].[DestQueue] WHERE Name = @rolename)

Please make a backup of your K2 Database and then seek out the assistance of deleting these entries with K2 Support's assistance. Supply the names of the roles that have been deleted as well as the current contents of the [Server].[DestQueue] and [Server].[DestQueueUser] table, utilizing the above queries to do so. Support can provide a query to run on your environment to clean out the deleted roles.  

The ability to delete the role without being presented with a notification that there are dependencies for the role; as well as not being able to delete the role from a process even after it is no longer in use, is a bug within K2 Management. If an attempt is made to delete the role from K2 Workspace, an exception error will appear and you cannot delete the role. These are currently under investigation internally. 

Note! Contact K2 Support if you require further assistance as database modification is not supported: 

https://www.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html