Jira server fails to start with Too many rows found for query on ClusteredJob error
Symptoms
JIRA fails to start and this error is thrown in JIRA_Home/log/atlassian-jira.log:
2016-01-31 13:16:10,207 localhost-startStop-1 ERROR [c.a.c.manager.application.ApplicationServiceGeneric] com.atlassian.cache.CacheException: java.lang.IllegalStateException: Too many rows found for query on ClusteredJob
row1: OfBizClusteredJob[id=10110,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10200,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Thu Feb 19 10:37:48 EET 2015,intervalInMillis=3600000]],nextRunTime=Wed Jan 27 19:55:13 EET 2016,version=2304,rawParameters=[ACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472...]]]row2:
OfBizClusteredJob[id=11106,delegate=ImmutableClusteredJob[jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10200,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager,schedule=Schedule[type=INTERVAL,intervalScheduleInfo=IntervalScheduleInfo[firstRunTime=Wed Jan 27 16:10:42 EET 2016,intervalInMillis=3600000]],nextRunTime=Sun Jan 31 12:10:42 EET 2016,version=93,rawParameters=[ACED000573720037636F6D2E676F6F676C652E636F6D6D6F6E2E636F6C6C6563742E496D6D757461626C6542694D61702453657269616C697A6564466F726D00...]]]
Diagnosis
- There are 2 entries with duplicate job_id and job_runner_key in clusteredjob table
According to the above error message, they are:
id=10110,jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10200,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager id=11106,jobId=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager.10200,jobRunnerKey=com.atlassian.jira.crowd.embedded.JiraDirectoryPollerManager
Please use this SQL to identify the duplicate entries in the database:
SELECT * FROM clusteredjob WHERE job_id in (SELECT job_id FROM clusteredjob GROUP BY job_id HAVING COUNT(*)>1)
Cause
The duplicate entry causes JIRA not to start up properly.
See related bug: - JRA-64325Getting issue details... STATUS
Resolution
Shut down JIRA and back up the database properly
Delete either of the entries:
delete from clusteredjob where id = 11106;
- For Oracle DB, ensure run
commit;
after the above. Restart JIRA