Start a conversation

Resolving CS Async Batch Driver Stalls Caused by Faulty Async Task Records

Symptom

CS Async Batch driver is not functioning. Online Order records are not being picked up for processing. Additionally, csutil async jobs may fail with the error: "You have uncommitted work pending".

Cause

A faulty Async Task Data record created due to user access issues prevents the batch driver from processing subsequent records. The bad record blocks all batch processing. Additionally, uncommitted DML operations in the current transaction can block external callouts, resulting in the "You have uncommitted work pending" error.

Resolution

Step 1: Check for stuck Async Task Data records

Run the following SOQL query to identify records that may be causing the block:

select id, csutil__async_task_class_name__c, CreatedDate, csutil__is_finished__c from csutil__Async_Task_Data__c where CreatedDate >= YESTERDAY and csutil__is_finished__c = false order by CreatedDate asc

Step 2: Identify faulty records

Review the results and identify records that may be causing the batch to stall.

Step 3: Delete or fix the problematic records

Delete or fix the problematic Async Task Data records. Deleting the bad record typically resumes batch processing.

Step 4: Check for csutil async job failures

If csutil async jobs are failing, run the following query:

select Id, CreatedDate, CreatedBy.name, JobType, ApexClass.name, Status, JobItemsProcessed, TotalJobItems, NumberOfErrors, CompletedDate, MethodName, ExtendedStatus, CronTriggerId from AsyncApexJob where ApexClass.NamespacePrefix = 'csutil' and (NOT ExtendedStatus like '%aborted%') and ExtendedStatus != '' order by CreatedDate desc

Step 5: Address "You have uncommitted work pending" errors

If jobs show "You have uncommitted work pending" in ExtendedStatus, find and remove the oldest csutil__Async_Task_Data__c records causing the issue. Uncommitted DML operations in the transaction block external callouts.

Additional Notes

  • The batch driver processes records sequentially. A single faulty record can halt processing for all subsequent records.
  • Always verify user access and permissions before creating Async Task Data records to avoid similar issues.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments