History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRA-14125
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Brad Baker [Atlassian]
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JIRA

SchedulerUtil is a robustness bug - It wont started scheduler if the jobs data is invalid

Created: 10/Dec/07 05:38 PM   Updated: 11/Dec/07 02:17 AM
Component/s: Services
Affects Version/s: 3.11
Fix Version/s: 3.13

Time Tracking:
Not Specified

Participants: Brad Baker [Atlassian]
Since last comment: 31 weeks, 5 days ago
Labels:


 Description  « Hide
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)


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brad Baker [Atlassian] - 10/Dec/07 05:39 PM
The current workaround is to delete the offending job entries and then have the code successfully complete and hence have the scheduler start