Details
-
Bug
-
Resolution: Fixed
-
Medium
-
3.11
-
3.11
-
Description
The code in SchedulerUtil has design fault such that if any jobs are invalid and throw exceptions and the scheduler is never started.
public void initializeAndStart(Scheduler scheduler) { SchedulerConfig config = new SchedulerConfig(); try { Map jobs = config.getJobs(); for (Iterator iterator = config.getTriggers().iterator(); iterator.hasNext();) { Trigger trigger = (Trigger) iterator.next(); scheduler.scheduleJob((JobDetail) jobs.get(trigger.getFullJobName()), trigger); } scheduler.start(); log.info("The scheduler has been launched."); } catch (Exception e) { log.error(e, e); } }
As you can see the call to scheduler.start() is only made if all defined jobs can be started.
A customer had a problem where they had "null cron" job entries and hence an exception was thrown but then because the scheduler doesnt start, none of their services ran from that point forward. For example there mail queue service didnt run.
We need to improve the code design to start the service regardless of job triggering failures.
Here is the strack trace
[com.atlassian.scheduler.SchedulerUtil] java.lang.IllegalArgumentException: Cron time expression cannot b e null java.lang.IllegalArgumentException: Cron time expression cannot be null at org.quartz.CronTrigger.setCronExpression(CronTrigger.java:672) at org.quartz.CronTrigger.<init>(CronTrigger.java:589) at com.atlassian.scheduler.OfBizJobStore.initialise(OfBizJobStore.java:111) at com.atlassian.scheduler.OfBizJobStore.storeJob(OfBizJobStore.java:174) at com.atlassian.scheduler.OfBizJobStore.storeJob(OfBizJobStore.java:168) at com.atlassian.scheduler.OfBizJobStore.storeJobAndTrigger(OfBizJobStore.java:161) at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:576) at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:221) at com.atlassian.scheduler.SchedulerUtil.initializeAndStart(SchedulerUtil.java:30) at com.atlassian.scheduler.SchedulerLauncher.contextInitialized(SchedulerLauncher.java:30) at com.atlassian.jira.scheduler.JiraSchedulerLauncher.contextInitialized(JiraSchedulerLauncher.java:30) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)