Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Starting batch job crashes the client

(0) ShareShare
ReportReport
Posted on by 1,935

Hi,

I'm trying to run a Batch job with many tasks, but my AX client crashes when I run the job to schedule the batch job and it's tasks.

I checked, AOS is set as batch server, so no issues with that.

Batch class:

class ParallelBatchTest extends RunBaseBatch
{
    #define.CurrentVersion(1)
    int batchNo;
}

public void new()
{
        super();
}

public container pack()
{
    return conNull();

}

private void parmBatchNo(int _batchNo)
{
        BatchNo = _batchNo;
}

void run()
{
    batchtest batchtest;

    batchtest.BatchNo=BatchNo;
    batchtest.insert();

}

public boolean unpack(container packedClass)
{
    return true;
}

public static ParallelBatchTest construct(int _batchNo)
{
    ParallelBatchTest  c;
    c = new ParallelBatchTest();
    c.parmBatchNo(_batchNo);
    return c;
}


Job to schedule batch and it's tasks:

static void batchTest(Args _args)
{
    BatchHeader                     batchHeader;
    ParallelBatchTest               parallelBatchTest;
    BatchInfo                       batchInfo;
    int                             i,taskCount=5;


    batchHeader = BatchHeader::construct();
    batchHeader.parmCaption(strFmt('Batch JOB 1'));

    for (i=1; i <= taskCount; i++)
    {
        parallelBatchTest = ParallelBatchTest::construct(i);
        batchInfo = parallelBatchTest.batchInfo();
        BatchInfo.parmCaption('BatchTest'+int2str(i));
        batchHeader.addTask(parallelBatchTest);
    }
    batchHeader.save();

    ttsCommit;
    info('Done');
}


Table:

0523.table.png

AX CLIENT CRASH:

ClientCrash.png

Will appreciate any tips to resolve the issue.

*This post is locked for comments

  • MYGz Profile Picture
    MYGz 1,935 on at
    RE: Starting batch job crashes the client

    Oh dear, I copied the code from web, removed the ttsbegin in editing and forgot to remove ttscommit. That is why the application was crashing. It shouldn't have ideally crashed though.

    As the Batch header is now getting created with the batch tasks, I'm facing the issue with the class variable 'BatchNo'.

    As you can see I'm assigning a new batchno to each object, all I'm getting is 0 inside the table.

    parallel_5F00_batch.png

    BatchNo column should have been 1,2,3,4,5. But It's all 0.

  • Suggested answer
    Hassan_rulz Profile Picture
    Hassan_rulz 3,801 on at
    RE: Starting batch job crashes the client

    Can you check what event logs you get in windows event?

    and resources are sufficient for this?

    what are the batch threads setting for the batch AOS?

  • MYGz Profile Picture
    MYGz 1,935 on at
    RE: Starting batch job crashes the client

    Thanks Ada, Ievgen for your reply.

    Forgot to mention that the client is only crashing for this particular Job for creating a Batch Job with many tasks.

    I'm able to run other batch jobs.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Starting batch job crashes the client

    It does not really matter what code you have there because client should not crash. Try to update client and kernel to latest version available and if it won't help, log a bug, so MS could fix it.

  • Suggested answer
    Jie G Profile Picture
    Jie G on at
    RE: Starting batch job crashes the client

    Hi MYGz,

    You can debug to find where the issue is.

    Open Visual Studio, in Debug click Attach to Process, select Ax32Serv.exe and click Attach.

    In Visual Studio, use the Application Explorer to open your batch class, set a breakpoint in the run method.

    Please refer: community.dynamics.com/.../how-to-debug-batch-jobs-and-service-operations-in-dynamics-ax-2012

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans