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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Deadlock issue when running job in batch franework

(0) ShareShare
ReportReport
Posted on by

Hi,

does anyone know if deadlock can have impact on batch job? I faced an issue with deadlock  database which has been removed later on but batch job still doesn't work. I don't receive any error massage but job itself is not done.

Thank you for info

Br

Kacper 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    we had similar issue, my solution is to have one batch server's "Maximum batch threads" to be configured to "1" (e.g. AOS1) [ Server Configuration form] .  and let the batch experiencing deadlock to run on AOS1 only. this will make the deadlock error disappear.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,049 Super User 2025 Season 2 on at

    The answer from Vincent will limit the power of the AX batch framework. You need to find out if the deadlock is caused on a table used in the batch job or if it is the batch tables itself. Then you can determine if you can find a cause and adjust the way the program is used in the batch or maybe you indeed need to do some setup related to the batch server like Vincent mentioned. It would not be my first suggestion to limit to one batch server and one thread.

    Can you also confirm if the batch job devides the work over multiple tasks?

  • Verified answer
    Bilal Issa Profile Picture
    4,370 on at

    Hi,

    I agree with André  , making the batch server run on thread is not a solution, you can use  SQL profile analyzer or the following query to check the deadlock,

    SELECT  L.request_session_id AS SPID,

       DB_NAME(L.resource_database_id) AS DatabaseName,

       O.Name AS LockedObjectName,

       P.object_id AS LockedObjectId,

       L.resource_type AS LockedResource,

       L.request_mode AS LockType,

       ST.text AS SqlStatementText,        

       ES.login_name AS LoginName,

       ES.host_name AS HostName,

       TST.is_user_transaction as IsUserTransaction,

       AT.name as TransactionName,

       CN.auth_scheme as AuthenticationMethod

    FROM    sys.dm_tran_locks L

       JOIN sys.partitions P ON P.hobt_id = L.resource_associated_entity_id

       JOIN sys.objects O ON O.object_id = P.object_id

       JOIN sys.dm_exec_sessions ES ON ES.session_id = L.request_session_id

       JOIN sys.dm_tran_session_transactions TST ON ES.session_id = TST.session_id

       JOIN sys.dm_tran_active_transactions AT ON TST.transaction_id = AT.transaction_id

       JOIN sys.dm_exec_connections CN ON CN.session_id = ES.session_id

       CROSS APPLY sys.dm_exec_sql_text(CN.most_recent_sql_handle) AS ST

    WHERE   resource_database_id = db_id()

    ORDER BY L.request_session_id

    Regards,

    Bilal

  • Verified answer
    Community Member Profile Picture
    on at

    Our deadlock  is caused by a 3rd party module and to get the deadlock fix is costing a lot so we used workaround.  the batch job we are running anyway only run once  per night so using single thread is not an issue for us.  

  • Verified answer
    Community Member Profile Picture
    on at

    the query is cool, thanks for sharing this Bilal.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Vincent16,

    Can you please update the Title of this thread (If possible)

    The Deadlock can be for anything. You may give it a meaningful title such as "Batch Deadlock Issue" so people can find it easily next time while googling

  • Verified answer
    Community Member Profile Picture
    on at

    I would like but cant't. this question is originated by 'Kacper'

  • Verified answer
    André Arnaud de Calavon Profile Picture
    301,049 Super User 2025 Season 2 on at

    Hi Sohaib,

    As moderator I have changed the title, but it is still not clear if it is related to the batch framework or the job itself. So I have chosen a bit generic description.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Thanks André Arnaud,

    that would work at least using keywords from google

  • Verified answer
    Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Hi Kacper, when the database is deadlocked, use SQL to see the blocked processes and to get the process id of the top process blocking all the others. Using the process id you can get the underlying SQL query of the process, this will give you a clue of which process is causing this.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans