web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

(0) ShareShare
ReportReport
Posted on by

We have a workflow that auto approves timesheets.  We may get hundres of these at a time.  In testing when more than 100 timesheets are "in review" this has resulted in deadlocks causing the workflow step to fail with errors like:

"Stopped (error): Cannot edit a record in Subledger journal entry (SubledgerJournalEntry). Ledger: 0, Current.
Deadlock, where one or more users have simultaneously locked the whole table or part of it."

What I noticed is that the batch job that runs sysworkflowmessagequeuemanager kicks of a task called sysworkflowqueuetask.  When there are more than one hundres workflows to process it kicks off 2 of them.  I'm guessing that they are both then trying to approve and post timecards simultaneously and causing the deadlock.  I can reproduce this issue and as long as I control the flow of new timecards the process runs without error.

So question is, does anyone know of a way to tell sysworkflowmessagequeuemanager not to run more thanone instance of sysworkflowqueuetask?

I found one article which suggests that the workflow process works in batches of 100 which put me onto this, but I can't find anything more.

Any help would be much appreciated.

PeterA

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    299,509 Super User 2025 Season 2 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    Hi Peter,

    i have seen this same error before, but did not investigated it as it seemed to be not reproducable. Now I think I understand what indeed could cause this error.

    I think the best you can do is create a support ticket at Microsoft. You can do it yourself on e.g. Customersource or contacting your partner.

  • Community Member Profile Picture
    on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    Thanks André I will do.  In the meantime, we increase the batch message size in the workflow macro.

  • Motz Jensen Profile Picture
    190 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    I know the thread is old, but maybe some one else can use this information.

    We saw the exact same behavior at customer on AX 2012 R3 CU9. Actually we saw this behavior across multiple tables / workflow implementations:

    • SubledgerJournalEntry
    • AccountingEvent
    • TSTimesheetTrans
    • TSTimeSheetProjBalance

    We saw these errors on a daily basis multiple times each day.

    We searched for the same error message as Peter Attwood and found this forum post. We searched LCS and found a similar bug description:

    https://fix.lcs.dynamics.com/Issue/Solution?bugId=3272330

    Microsoft solution to the bug:

    This issue is a result of workflow batch job conflicting as the batch job recurrence was set to 1 minute.

    To resolve this issue Increase the time of the workflow batch job recurrence. This will prevent a second workflow job from executing before the first one completes. Recommend to start with 5 minutes and then move to 10 minutes if the error continues. 

    So what we are facing is some kind of race condition. 

    I hope this can help some one out there.

  • mail2vd Profile Picture
    1,330 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    Hi Motz,

    We have the exact same issue as peter mentioned.

    I had a look at LCS link you mentioned. I believe it's for different process. Solution may be the same for my issue but difficult to convince customer about it as it's not specifically mentioned for Timesheet Approval.

    Do you have any information if microsoft has mentioned for timesheet?

  • mail2vd Profile Picture
    1,330 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    Hi Peter,

    Did it help you when you changed the BatchSize in Worfklow Macro?

  • mail2vd Profile Picture
    1,330 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    We are getting the deadlock for AccountingEvent.  The batch runs TSTimesheetsPostOperation.run() method and somewhere later on deadlock is happening. Not sure where.

    We tried setting workflow batch processing job recurrence to 10 minutes but didn't help at all.

    I have seen the batch job history and it has failed even when only 1 timesheet has been approved and getting posted by this batch.   It means AccountingEvent is getting used somewhere by user or any other process than timesheet where it is getting locked and hence timesheet batch job gets deadlock.

    Can anyone please guide here?

  • Suggested answer
    DAX_ajsqd2 Profile Picture
    269 on at
    RE: Workflow Batch process sysworkflowmessagequeuemanager causing deadlocks

    Hi everyone,

    We had this exact same issue and saw it was because database logging was turned on. Once we turned off database logging it worked. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans