+ Start a Discussion
kranjankranjan 

Batch jobs getting stuck and not running for much more than the scheduled run time

Hi,

 

I am facing an issue where we have a product in which there are 3 batch jobs which run on an interval of 1 min, 30 min and 1 min respectively as they need to sync up the data almost real time. However I am facing a peculiar issue where the batch jobs do not run at their scheduled run time and even are stuck for more than 2 hours in a sandbox org. I understand that batch jobs, future methods are asynchronous routines and run as per the availability of resources. However I have never seen such behavior before where jobs are stuck for hours. Also the same types of jobs working in same model for the same product are working perfectly fine in another sandbox org.

 

Does anyone has any idea and let know why is this happening and is there anything that can be done to resolve the same.

 

Regards

Kamal Ranjan

HariDineshHariDinesh

Hi,
Here you are scheduling batch class. And as per you words there are 3 batch jobs which will run one after other like first job starts after 30 mints second will be scheduled and after 1 mint 3rd will be scheduled.
Here what do you mean by “Batch jobs do not run at their scheduled run time”?
Batch jobs are scheduled by scheduler but not executing and you can find them in Apex Jobs?
OR
Batch jobs itself not scheduled? (You can find in Scheduled Jobs)


And I want to know 2 points here
You face this problem only once or faced multiple times in that sandbox?
    If it happens only once reason might be SF resources.
Can you confirm that data is same in Both Sandbox s?

kranjankranjan

Hi Hari,

 

The 3 batch jobs do not run in sequence. They are independent of each other. 1min, 30 min and 1 min which i mentioned is their frequency to run betwen their own consecutive schedules respectively.

 

And the batch jobs are scheduled via code. They do appear in scheduled jobs and also show their next run time as per the frequency mentioned above. However at times they do not run at that time and run they after 1 or 2 hours. Also this issue is not seen just once but was seen a little frequent since last 2 days. Though it is not that frequent as well usually. As far as the data in the sandboxes are concerned, the data can be different as they are seperate sandboxes but the code to sync and the way batch jobs are scheduled and should work is same.

 

I understand that data can make difference as far as execution is concerned. But what is nto consistent is that they just do not stop forever. They do run on their own after a gap which is definitely much more than the next scheduled run time. But in between they are kind of stuck.

 

Hope I have answered your questions. Let me know if i can provide any more information.

 

Kamal

HariDineshHariDinesh

Hi,

 

The information you have given is good enough and most concern thing is those are working fine in one sandbox and not in other.

 

As per my understanding difference in data might be one reason.

And currently I to don’t have any idea why it is behaving like this and I didn’t faced scenario of this type.

Thanks for providing clear information.