Empty queue error appear in logs even after a role was deleted
kbt134729
PRODUCTIssue
There appears to be poor performance within the K2 Environment. This could include but is not limited to:
- Smartforms take an extended period of time to load, or time out.
- Extended wait times on searches within K2 Management or Workspace.
- SQL appears to be under high resource usage.
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 blackpearlHost ServerBin","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 blackpearlHost ServerBin","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.
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