Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Batch job stuck with executing status.

Posted on by 465

Hi everyone

I am using Ax 2012 R3

I am working on a batch job in which I have to implement the multi threading concept in it. I have implemented it and it is working fine. But, when I run this for bigger pool of data, I missed adding code to control the number of threading and it lead to creation of lakhs of threads and the batch job is stuck in "Executing" state.

I have tried to put it in waiting state to stop it but no luck. I have also tried to restart the services and it didn't work. I have fixed the code part. But, I am not able to stop this which is not allowing me to run CIL as well to take the effect of new code change.

Please suggest me what I need to do to stop this batch job.

  • AnithaEswaran Profile Picture
    AnithaEswaran 2,032 on at
    RE: Batch job stuck with executing status.

    Hi Verma,

    I`ve posted the solution in my blog.

    anithasantosh.wordpress.com/.../

    This is applicable for D365FO as well.

    You can get access to UAT SQl Db from LCS and execute the given SQL statements. That should solve your issue.

  • RE: Batch job stuck with executing status.

    Hello Verma,

    Have you tried restart the AOS ?

    regards,

    Harshal

  • VermaMC Profile Picture
    VermaMC 465 on at
    RE: Batch job stuck with executing status.

    Let me rephrase if I am communicating wrong.

    I have tried to update the batch job status to Cancelling and it got stuck. So, I updated the batch job status through SQL to Cancelled. However, the multi threading tasks of that batch job are still executing and many are in Ready state as well.

    I even tried to put the batch job to Withhold thinking that it would stop the execution of the tasks beneath it but no luck as it just gets stuck there when I tried to change it.

  • RE: Batch job stuck with executing status.

    Hello Verma MC,

    is it still showing the same behavior or the task status got cancelled as well?

  • VermaMC Profile Picture
    VermaMC 465 on at
    RE: Batch job stuck with executing status.

    No, it was not stuck in Canceling. It was stuck in Executing and it remained the same even when I tried to change the status to canceled. The restart didn't help and remained in the executing.

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: Batch job stuck with executing status.

    Hi,

    Please try restarting the AOS service if it is stuck at cancelling. That should change the status back to Cancelled killing all the threads.

  • VermaMC Profile Picture
    VermaMC 465 on at
    RE: Batch job stuck with executing status.

    Thanks for the replies.

    I have tried to cancel the batch job. But, it got stuck without responding when I try to change the status to Canceling.

    So, I have run a SQL query and updated it to Cancelled. However, the tasks under the batch job are still executing. So, it is not totally getting stopped.

    Let me know if I can do anything further on it.

  • RE: Batch job stuck with executing status.

    Hello Chiranjeevim7,

    If you have access to the database then can you try to run SQL query and change the status from backend database on the batch job table . below are the status for your reference.

         

                                                 BATCH.status = 1 then 'Waiting'

                                                 BATCH.status = 2 then 'Executing'

                                                 BATCH.status = 3 then 'Error'

                                                 BATCH.status = 4 then 'Ended'

                                                 BATCH.status = 5 then 'Ready'

                                                 BATCH.status = 6 then 'Not Run'

                                                 BATCH.status = 7 then 'Cancelling'

                                                  BATCH.status = 8 then 'Cancelled'

    Regards,

    Harshal

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: Batch job stuck with executing status.

    Hi Verma MC,

    Have you tried to cancel the batch job by changing the status to "Cancelled"? When the job is cancelled, you can delete the job and can add a new batch job which would have your latest code.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans