Options

Deadlock when using Job Queues

gpdiatgpdiat Member Posts: 13
edited 2015-09-18 in NAV Three Tier
Hello i am having a problem related to Job Queues and i would very much appreciate it if you could help me out.

Here is the problem:

I have created two separate Job Queues:
Job_Queues_List.jpg

And their cards:
Job_Queue_1_Card.jpg Job_Queue_2_Card.jpg

The first Job Queue is created for running a Codeunit every 3 minutes and the second for running a report once every day.
Job_Queue_Entry_1_Card.jpg Job_Queue_Entry_2_Card.jpg

The problem is that every once in a while, for some unknown reason the second Job Queue stops and i have to restart it. I dont undestand why this is happening. The error in the event viewer is the following:
Log Name:      Application
Source:        MicrosoftDynamicsNavServer$DynamicsNAV71
Date:          16/9/2015 12:10:46 μμ
Event ID:      216
Task Category: (13)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      proderp.icap.gr
Description:
Server instance: DynamicsNAV71
Tenant ID: default
Session type: Background
Session ID: 3082
User: ICAP\DYNAMIC
Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException
Remappable: True
ErrorCode: 22926089
ErrorNumber: 54025
ModuleNumber: 93
SuppressMessage: False
FatalityScope: None
Message: Your activity was deadlocked with another user modifying the Job Queue Entry table.
StackTrace:
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementationHelper.MapException(NavCSideException originalException, NCLMetaTable metaTable, IRecordBuffer recordBuffer, Boolean makeNewExceptionRemappable)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.FindFirstRecord(DataError errorLevel)
     at Microsoft.Dynamics.Nav.Runtime.NavRecord.ALFindFirst(DataError errorLevel)
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.GetNextRequest_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.GetNextRequest(INavRecordHandle jobQueueEntry)
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.JobQueueLoop_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun(INavRecordHandle εrec)
     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)
     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.InvokeRun(Int32 objectId, Object[] args)
     at Microsoft.Dynamics.Nav.Runtime.ALSession.RunCodeunitAndDisposeSession(NavSession session, Int32 codeUnitId, NavRecord record)
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2146233088
----------------------------------
Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException
Remappable: True
ErrorCode: 22926089
ErrorNumber: 54025
ModuleNumber: 93
SuppressMessage: False
FatalityScope: None
Message: Your activity was deadlocked with another user modifying the Job Queue Entry table.
StackTrace:
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.CheckAndthrowTrapableErrors(Int32 errorNumber, NavSqlException navSqlException)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.MapException(SqlException exception, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteFunction[T](Func`1 function, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteFunctionWithTrace[T](EventTask task, Func`1 function, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlCommand.ReadNextRow()
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.ExecuteFindTop(FilterExpression filter, Boolean onlyCurrentKeyFieldsNeeded)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteCommandAndCacheOnSuccess[T](NavSqlCommandCacheKey commandKey, Func`1 createFunc, Func`2 executeFunc)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.FindTop1(NavDatabase database, NCLMetaTable table, Int32 companyIndex, Byte findMethod, Boolean locking, Boolean onlyCurrentKeyFieldsNeeded, FieldList orderByFields, FilterExpression filter)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.FindTop1(NavDatabase database, PositionedFindProviderRequest request, Boolean onlyCurrentKeyFieldsNeeded)
     at Microsoft.Dynamics.Nav.Runtime.SqlTableDataProvider.TableFindFromPosition(NCLMetaTable table, PositionedFindProviderRequest request, Func`1 onlyCurrentKeyNeededForNextRow)
     at Microsoft.Dynamics.Nav.Runtime.DataAccess.InnerFind(FindCacheRequest request, Boolean fromPosition, Func`1 onlyCurrentKeyNeededForNextRow)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2146233088

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="MicrosoftDynamicsNavServer$DynamicsNAV71" />
    <EventID Qualifiers="0">216</EventID>
    <Level>2</Level>
    <Task>13</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-09-16T09:10:46.000000000Z" />
    <EventRecordID>494072</EventRecordID>
    <Channel>Application</Channel>
    <Computer>proderp.icap.gr</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Server instance: DynamicsNAV71
Tenant ID: default
Session type: Background
Session ID: 3082
User: ICAP\DYNAMIC
Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException
Remappable: True
ErrorCode: 22926089
ErrorNumber: 54025
ModuleNumber: 93
SuppressMessage: False
FatalityScope: None
Message: Your activity was deadlocked with another user modifying the Job Queue Entry table.
StackTrace:
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementationHelper.MapException(NavCSideException originalException, NCLMetaTable metaTable, IRecordBuffer recordBuffer, Boolean makeNewExceptionRemappable)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.FindFirstRecord(DataError errorLevel)
     at Microsoft.Dynamics.Nav.Runtime.NavRecord.ALFindFirst(DataError errorLevel)
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.GetNextRequest_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.GetNextRequest(INavRecordHandle jobQueueEntry)
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.JobQueueLoop_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun_Scope.OnRun()
     at Filter.InvokeWithFilter(NavMethodScope )
     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun(INavRecordHandle εrec)
     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)
     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.InvokeRun(Int32 objectId, Object[] args)
     at Microsoft.Dynamics.Nav.Runtime.ALSession.RunCodeunitAndDisposeSession(NavSession session, Int32 codeUnitId, NavRecord record)
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2146233088
----------------------------------
Type: Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException
Remappable: True
ErrorCode: 22926089
ErrorNumber: 54025
ModuleNumber: 93
SuppressMessage: False
FatalityScope: None
Message: Your activity was deadlocked with another user modifying the Job Queue Entry table.
StackTrace:
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.CheckAndthrowTrapableErrors(Int32 errorNumber, NavSqlException navSqlException)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.MapException(SqlException exception, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteFunction[T](Func`1 function, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteFunctionWithTrace[T](EventTask task, Func`1 function, NavSqlCommand command)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlCommand.ReadNextRow()
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.ExecuteFindTop(FilterExpression filter, Boolean onlyCurrentKeyFieldsNeeded)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteCommandAndCacheOnSuccess[T](NavSqlCommandCacheKey commandKey, Func`1 createFunc, Func`2 executeFunc)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.FindTop1(NavDatabase database, NCLMetaTable table, Int32 companyIndex, Byte findMethod, Boolean locking, Boolean onlyCurrentKeyFieldsNeeded, FieldList orderByFields, FilterExpression filter)
     at Microsoft.Dynamics.Nav.Runtime.NavSqlIsamQueryCommand.FindTop1(NavDatabase database, PositionedFindProviderRequest request, Boolean onlyCurrentKeyFieldsNeeded)
     at Microsoft.Dynamics.Nav.Runtime.SqlTableDataProvider.TableFindFromPosition(NCLMetaTable table, PositionedFindProviderRequest request, Func`1 onlyCurrentKeyNeededForNextRow)
     at Microsoft.Dynamics.Nav.Runtime.DataAccess.InnerFind(FindCacheRequest request, Boolean fromPosition, Func`1 onlyCurrentKeyNeededForNextRow)
     at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
Source: Microsoft.Dynamics.Nav.Ncl
HResult: -2146233088
</Data>
  </EventData>
</Event>

Both Job Queues run with the same user, who is a SUPER user.
The only thing i have noticed is that the error happens while the first Job Queue is running. I dont understand why those two Job Queues have a conflict with each other, since i have configured the first Job Queue Entry to run until 9pm and the second to run only every day at 10pm. Why does the message say that another user is modifying the Job Queue Entry table, since those two Jobs never run at the same time?

Any help would be very much appreciated!

Comments

  • Options
    bbrownbbrown Member Posts: 3,268
    The Job Queue runs continuously as it checks for something to do. It's only the task (Job Queue Entries) that run only when scheduled.

    Setup SQL Extended Events to log information about the deadlocks. This will identify the offending SQL statements and help you to isolate the issue.
    There are no bugs - only undocumented features.
  • Options
    gpdiatgpdiat Member Posts: 13
    Thank you bbrown. I'll try what you are suggesting and post my findings.
  • Options
    soetiesoetie Member Posts: 61
    did you find a solution for this?
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I'm curious too...
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    RajjRajj Member Posts: 1
    Facing the same issue. Can anyone help me out over her. Having Nav 2015 version
Sign In or Register to comment.