Clean ownership task is not working
search cancel

Clean ownership task is not working

book

Article ID: 253058

calendar_today

Updated On:

Products

Client Management Suite Asset Management Suite

Issue/Introduction

For several days we had been following this task schedule result and is not working properly. 

We see the following error in the Notification Server logs:

Error running cleanup task within schedule.

Error number 50000 is invalid. The number must be from 13000 through 2147483647 and it cannot be 50000.
A cursor with the name 'OwnershipDetailsResources_Cursor' already exists.
The cursor is already open.
   [System.Data.SqlClient.SqlException @ .Net SqlClient Data Provider]

Server stack trace: 
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Altiris.AssetContractCommon.Tasks.CleanupOwnershipTask.CleanOwnership()
   at Altiris.AssetContractCommon.Tasks.CleanupOwnershipTask.OnSchedule(String identifier)

SQL Exception details: code=2732, line=739, procedure=spAC_CleanupOwnership

Exception logged from: 
   at Altiris.AssetContractCommon.Tasks.CleanupOwnershipTask.OnSchedule(String)
   at RuntimeMethodHandle.InvokeMethod(Object, Object[], Signature, Boolean)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object, Object[], Object[])
   at System.Reflection.RuntimeMethodInfo.Invoke(Object, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo)
   at Altiris.AssetContractCommon.Operation.ScheduleHandler.Execute(Altiris.DotNetLib.Collections.ParameterValueCollection, Altiris.DotNetLib.Collections.ParameterValueCollection)
   at Altiris.AssetContractCommon.Operation.OperationTask.OnExecute(Altiris.TaskManagement.ServerTasks.IServerTaskExecutionInstance)
   at Altiris.TaskManagement.ServerTasks.BaseServerTask.OnExecute(Altiris.TaskManagement.Common.Execution.Engine.ITaskExecutionEngine, Altiris.TaskManagement.ServerTasks.IServerTaskExecutionInstance, Altiris.TaskManagement.Common.Execution.Engine.TaskInstanceRequest)
   at Altiris.TaskManagement.ServerTasks.BaseServerTask.Execute(Altiris.TaskManagement.Common.Execution.Engine.ITaskExecutionEngine, Altiris.TaskManagement.Common.Data.IBaseTaskExecutionInstance, Altiris.TaskManagement.Common.Execution.Engine.TaskInstanceRequest)
   at Altiris.TaskManagement.Common.Execution.Engine.TaskEngineExecutionThread.ExecuteTaskHandler()
   at Altiris.TaskManagement.ServerTasks.ServerTaskExecutionThread.ExecuteTaskHandler()
   at Altiris.TaskManagement.Common.Execution.Engine.TaskEngineExecutionThread.Execute()
   at Altiris.TaskManagement.Common.Execution.Engine.TaskExecutionEngine.ProcessTaskExecuteOperation(Altiris.TaskManagement.Common.Execution.Engine.TaskInstanceRequest, Altiris.TaskManagement.Common.Execution.Engine.TaskEngineExecutionThread)
   at Altiris.TaskManagement.ServerTasks.ServerTaskManager.ProcessTaskExecuteOperation(Altiris.TaskManagement.Common.Execution.Engine.TaskInstanceRequest, Altiris.TaskManagement.Common.Execution.Engine.TaskEngineExecutionThread)
   at Altiris.TaskManagement.Common.Execution.Engine.TaskExecutionEngine.ProcessTaskExecuteOperation(Object)
   at Altiris.DotNetLib.Threading.AtrsThreadPoolEx.ProcessWorkToDo(System.Threading.Thread, Altiris.DotNetLib.Threading.AtrsThreadPoolWorkItemEx)
   at Altiris.DotNetLib.Threading.AtrsThreadPoolEx.ProcessWorkToDo()
   at Altiris.DotNetLib.Threading.AtrsThreadPoolEx.WorkerThreadRun()
   at Altiris.DotNetLib.Threading.AtrsThreadPoolEx.WorkerThreadProc()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, Object)
   at System.Threading.ThreadHelper.ThreadStart()

 

Environment

Release : 8.6

Cause

One of the associations had 0000 GUIDs on the results

Resolution

Run the following query. If the results include GUIDs with all zeros, contact technical support.

 declare
   @RA_USER_OWNERS uniqueidentifier,
   @RA_DEPARTMENT_OWNERS uniqueidentifier,
   @RA_SOFTWAREPURCHASE_USER_OWNERS uniqueidentifier,
   @RA_SOFTWAREPURCHASE_DEPARTMENT_OWNERS uniqueidentifier
 declare @OwnershipRule varchar(100)
 declare @RATypeDelete uniqueidentifier
 declare @RASoftwarePurchaseTypeDelete uniqueidentifier
 declare @MultipleEnabled bit
 declare @LastError int

 set @RA_USER_OWNERS = 'ED35A8D1-BF60-4771-9DDE-092C146C485A'
 set @RA_DEPARTMENT_OWNERS = '1466e770-4413-4517-a89d-6599b8a7f144'
 set @RA_SOFTWAREPURCHASE_USER_OWNERS ='5cf17724-8f75-4505-8898-7b42d8cd62da'
 set @RA_SOFTWAREPURCHASE_DEPARTMENT_OWNERS = '0DA075AC-6FCA-411c-AEEC-AE1003FA93E6'
   create table #MetaAssociationAssetTemp
   (
    ResourceAssociationTypeGuid uniqueidentifier,
    ParentResourceGuid uniqueidentifier,
    ChildResourceGuid uniqueidentifier,
    Percentage float
   )
   insert into #MetaAssociationAssetTemp

   select ResourceAssociationTypeGuid, ParentResourceGuid, ChildResourceGuid, 0
   from (select * from ResourceAssociation where
     (ResourceAssociation.ResourceAssociationTypeGuid = @RA_USER_OWNERS)
     or
     (ResourceAssociation.ResourceAssociationTypeGuid = @RA_DEPARTMENT_OWNERS)) as ra
   left join Inv_Ownership_Details o on 
    (o._ResourceGuid = ra.ParentResourceGuid) and (o.Owner = ra.ChildResourceGuid)
   where
    --just get the records that have not been synchronised
    (o._id is null)
   select * from #MetaAssociationAssetTemp
   drop table #MetaAssociationAssetTemp