0

In the Apex jobs screen, I am seeing a lot of jobs stuck in Queued status close to 120 jobs.

Many of those jobs are aborted

enter image description here

And some of them failed with errors

Scheduler: failed to execute scheduled job: jobId: , class: common.apex.async.AsyncApexJobObject, reason: You've exceeded the limit of 100 jobs in the flex queue for org . Wait for some of your batch jobs to finish before

enter image description here

As per the salesforce documentation, You can only have 100 scheduled Apex jobs at one time.

So my question is do these Queued Scheduled Apex Jobs affect the 100 limits? And any reason why these are stuck in Queued status in the Apex Jobs screen?

I have checked some of the other already posted questions like this with no satisfying answers.

Any suggestions will be much appreciated.

1 Answer 1

1

When the batch job or scheduler job invoked , it will add to the flex queue . In a single instance/Environment at a time only 5 jobs will be in progress status which means these are running currently . Which means salesforce will give 5 slots to each org . If we executed 100 jobs at time , all jobs will add first to flex queue and five jobs will start executing and rest all will be waiting in queued status.

The reason for stucking in queue status is due to the long running jobs in the 5 available slots .

There are multiple failures in your org.

  1. Same job is executing in 2 times in 5 available slots or two different jobs executing in 5 slots are trying to make the dml operation for same records. In this kind of scenario - it will throw object is locked error

  2. Due to reason 1 , one or multiple jobs are stuck in progress status for a long time . In a mean time there are more then 100 scheduler jobs triggered and hit the limit 100 flex queue governor limit.

1
  • Do these Scheduled Apex Jobs in Queued status affect the 100 limits? The apex jobs screen already shows 120 records with type=Scheduled Apex and Status=Queued. If 100 is the limit how 120 records are there? Commented Nov 18, 2022 at 8:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .