The atlassian-scheduler job takes forever to start in Jira

When customers start a bulk operation, we launch a job through the atlassian-scheduler (Jira, Data Center). But customers report to us that it takes forever before the job actually starts!

public String runJob(
            String userKey,
            List<JiraConfluenceSharedBeans.IssueRequest> issueRequests,
            String confluenceApplinkId,
            long jiraJobId,
            long issueTemplateId
    ) throws SchedulerServiceException {
        Schedule schedule = Schedule.runOnce(Date.from(Instant.now().plus(3, ChronoUnit.SECONDS)));
        Map<String, Serializable> parameters = Maps.newHashMap();
        parameters.put("userKey", userKey);
        parameters.put("issueRequests", GSON.toJson(issueRequests));
        parameters.put("confluenceApplinkId", confluenceApplinkId);
        parameters.put("jiraJobId", jiraJobId);
        parameters.put("issueTemplateId", issueTemplateId);
        JobConfig jobConfig = JobConfig
                .forJobRunnerKey(JobRunnerKey.of(JOBRUNNER_KEY))
                .withSchedule(schedule)
                .withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)
                .withParameters(parameters);
        JobId jobId = schedulerService.scheduleJobWithGeneratedId(jobConfig);
        return jobId.toString();
    }

I guess there is a lock which prevents the user from starting, but how can I diagnose?

  • It could be the RUN_ONCE_PER_CLUSTER flag, which waits for jobs with the same “runner key” to finish, but we don’t see traces of that,
  • It could be that Jira only has a few threads and they are all busy with other jobs, but if I take the thread name (Caesium-1-4 in my situation), the last related log for that thread is 30s before (it could be because its logs levels are higher than INFO, though),
  • Have you experienced any job which was taking forever to start?

Thank you,
Adrien Ragot, for Requirement Yogi