Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-64325

Jira fails to start due to duplicate job IDs in the clusteredjob table

XMLWordPrintable

    • 7.01
    • 55
    • Severity 1 - Critical
    • 1,303
    • Hide
      Atlassian Update – 12 January 2018

      Hi everyone,

      All the Jira versions, which have the bug fixed, are now released.
      Wish you a smooth upgrade.

      Cheers,
      Ignat Alexeyenko
      Jira bugmaster.

      Show
      Atlassian Update – 12 January 2018 Hi everyone, All the Jira versions, which have the bug fixed, are now released. Wish you a smooth upgrade. Cheers, Ignat Alexeyenko Jira bugmaster.

      Summary

      Caesium method getJobDetails calls clusteredJobDao.find(jobId) and expects single uniq value from DB, while clusteredjob table does not ensure this.

      Steps to Reproduce

      1. Create duplicated records in table
      2. Restart JIRA

      Expected Results

      JIRA works fine

      Actual Results

      JIRA is failing to start with the following errors:

      2017-03-03 02:26:53,599 Structure-Jobs-1143be31 Queue-Thread#1 ERROR anonymous     [c.a.c.manager.application.ApplicationServiceGeneric] com.atlassian.cache.CacheException: java.lang.IllegalStateException: Too many rows found for query on ClusteredJob
          	row1: OfBizClusteredJob[id=81932,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10001,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Fri Mar 03 01:56:51 PST 2017,intervalInMillis=3540000]],nextRunTime=Fri Mar 03 01:56:51 PST 2017,version=1,rawParameters=[ .. ]
      row2:
      	OfBizClusteredJob[id=82235,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10001,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Fri Mar 03 01:56:51 PST 2017,intervalInMillis=3540000]],nextRunTime=Fri Mar 03 01:56:51 PST 2017,version=1,rawParameters=[ .. ]]
      com.atlassian.crowd.exception.DirectoryInstantiationException: com.atlassian.cache.CacheException: java.lang.IllegalStateException: Too many rows found for query on 
      	at com.atlassian.crowd.directory.loader.CacheableDirectoryInstanceLoader.getDirectory(CacheableDirectoryInstanceLoader.java:92)
      	at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.getDirectoryImplementation(DirectoryManagerGeneric.java:272)
      ....
      Caused by: com.atlassian.cache.CacheException: java.lang.IllegalStateException: Too many rows found for query on ClusteredJob
      	row1: OfBizClusteredJob[id=81932,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10001,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Fri Mar 03 01:56:51 PST 2017,intervalInMillis=3540000]],nextRunTime=Fri Mar 03 01:56:51 PST 2017,version=1,rawParameters=
      row2:
      	OfBizClusteredJob[id=82235,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10001,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Fri Mar 03 01:56:51 PST 2017,intervalInMillis=3540000]],nextRunTime=Fri Mar 03 01:56:51 PST 2017,version=1,rawParameters=
      	at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl$1.consume(SelectQueryImpl.java:198)
      	at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.forEach(SelectQueryImpl.java:231)
      	at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:214)
      	at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.singleValue(SelectQueryImpl.java:191)
      	at com.atlassian.jira.scheduler.OfBizClusteredJobDao.find(OfBizClusteredJobDao.java:88)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.getJobDetails(CaesiumSchedulerService.java:230)
      	at com.atlassian.scheduler.core.DelegatingSchedulerService.getJobDetails(DelegatingSchedulerService.java:97)
      	at com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.hasPoller(JiraDirectoryPollerManager.java:64)
      	at com.atlassian.crowd.manager.directory.monitor.DirectoryMonitorManagerImpl.hasMonitor(DirectoryMonitorManagerImpl.java:108)
      	at com.atlassian.crowd.directory.loader.DbCachingRemoteDirectoryInstanceLoader.getDirectory(DbCachingRemoteDirectoryInstanceLoader.java:113)
      ...
      

      Notes

      Related Indexes for clusteredjob table:

      • "pk_clusteredjob" PRIMARY KEY, btree (id)
      • "clusteredjob_jobid_idx" btree (job_id)

      Workaround

              pczuj Przemyslaw Czuj
              ayakovlev@atlassian.com Andriy Yakovlev [Atlassian]
              Votes:
              67 Vote for this issue
              Watchers:
              84 Start watching this issue

                Created:
                Updated:
                Resolved: