function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ron-LONRon-LON 

ERROR: Batchable class has jobs pending or in progress

Hi,

 

Does anyone know what this is about?  I'm trying to save a class that has an @future in it.  I've been working with it for many days and doing lots of different unit test scenarios.  I've been using a development org.

 

I've been able to save it before for all these days, but now I'm getting this error: "Batchable class has jobs pending or in progress" when I try to save it.  It's been in that state for at least an hour.

 

How long should these jobs pending usually take?  How long should I wait to do something about it .... and then what exactly would I then do??

 

Any help is appreciated!!

 

Thanks!!

Best Answer chosen by Admin (Salesforce Developers) 
Ron-LONRon-LON

After nine or ten hours, these finally executed due to the following:

 

Root cause: The Salesforce.com Technology Team became aware of a performance degradation affecting the NA6 instance. The problem began at 12/03 1512 hrs UTC due to a database hardware failure and was resolved by 12/04 0545 hrs UTC. For the duration of the incident, customers would have experienced unavailability of these services - Automated Dashboard Refreshes, Sandbox Refreshes, Processing of new Sandbox requests, Analytic Reports, Asynchronous Apex Requests. We sincerely apologize for any inconvenience this might have caused you.

All Answers

Ron-LONRon-LON

After nine or ten hours, these finally executed due to the following:

 

Root cause: The Salesforce.com Technology Team became aware of a performance degradation affecting the NA6 instance. The problem began at 12/03 1512 hrs UTC due to a database hardware failure and was resolved by 12/04 0545 hrs UTC. For the duration of the incident, customers would have experienced unavailability of these services - Automated Dashboard Refreshes, Sandbox Refreshes, Processing of new Sandbox requests, Analytic Reports, Asynchronous Apex Requests. We sincerely apologize for any inconvenience this might have caused you.

This was selected as the best answer
Graham_MacRobieGraham_MacRobie

This is happening again today.  I'm getting the error trying to save a class with @future to the sandbox (tapp0).

 

Merry Christmas!

LegerdemainLegerdemain

Batch apex classes cannot be changed while there are still batches in the apex queue. You can view this queue under Setup | Administration Setup | Monitoring | Apex Jobs

 

While you have jobs being processed you cannot change the apex class that is handling the active (or pending) processes. You can abort these processes if you need to stop execution of batch jobs.

boBNunnyboBNunny

I found an answer to this issue that I think SFDC needs to address.  If you are simply migrating a class that is not Batchable, then you need to look for all APEX Jobs that are Queued or In Progress (create a view).  Find any not running in the past couple of minutes of so and Abort them.  They are hung jobs that SFDC somehow doesn't flag as hung or terminated, but the migration sees them.  Active SFDC APEX Jobs don't seem to matter.  I think SFDC should have a process that when a process is running for more than X minutes, mark it as Terminated so that the migration process doesn't see them.  I've already mentioned this to them.  Hope this helps.  Thanx!

boBNunnyboBNunny

Here is another update on how to fix this.

 

- Copy ALL jobs from the Apex Jobs screen to the clipboard (Setup/Administrative Setup/Monitoring/Apex Jobs).

- Paste them into APEX, and then use Text to Columns to segregate just the ID column (the last one).

- Create a formula in the next cell of: ="system.abortjob('" & A2 & "');"

This will give you someting like: system.abortjob('70a12354564354');

- Open System Log, and paste all of the system.abortjob statements into the Execute window and execute.

 

After processing, they should all be gone.

 

(BTW, you may have more than one window of batch jobs to process.)