I've noticed some strange behaviour in an org which I've not seen before regarding Apex Jobs.
It seems all batch jobs, which are started by a scheduled apex job, never run straight away and are always placed into the Apex Flex Queue in a "Holding" state and are only started once another job is added to the queue.
This behaviour means that if we have 2 scheduled batch apex jobs, one set to run daily at 03:00 (Batch A) and another daily at 04:00 (Batch B), Batch A is held from 03:00 until 04:00 when it then runs (because Batch B is added), but the Batch B then won't run until 03:00 the next day, 23 hours later, because Batch A has started again.
To get around this, as a temporary measure, I've created 4 new hourly batch jobs (running at ?:01, ?:16, ?:31 & ?:46) to ensure the jobs get processed more frequently.
From the Flex Queue Docs:
You can place up to 100 batch jobs in a holding status for future execution. When system resources become available, the jobs are taken from the top of the Apex flex queue and moved to the batch job queue. Up to five queued or active jobs can be processed simultaneously for each org.
This would imply that system resource isn't available, but how could that be if when the next job is started, it seems to force/allow the last job to start running, even though no other jobs are currently running in the background.
All the jobs are being executed using:
Database.executeBatch(new ThisIsMyApexBatchClass());
Any insight into why this is happening would be appreciated, since I believe this to be a problem on the platform, and previous efforts to get help from Salesforce Support are proving fruitless, and just directing us to the forums.
Thanks