Jira upgrade fails due to "The provided cron string does not have 7 parts" errors
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The customers cannot upgrade Jira due to a configuration error in the scheduled tasks. The error below is thrown in Jira logs:
2024-04-08 11:13:35,858+0100 JIRA-Bootstrap ERROR [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Upgrade task [host,buildNumber=819000] failed
java.lang.RuntimeException: Error running original upgrade task
at com.atlassian.jira.upgrade.AbstractUpgradeTask.runUpgrade(AbstractUpgradeTask.java:63)
at com.atlassian.upgrade.core.DefaultUpgradeTaskFactoryProcessor.runOneUpgradeTask(DefaultUpgradeTaskFactoryProcessor.java:109)
at com.atlassian.upgrade.core.DefaultUpgradeTaskFactoryProcessor.lambda$performUpgradesUnsafe$13(DefaultUpgradeTaskFactoryProcessor.java:80)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:400)
at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:500)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
at com.atlassian.upgrade.core.DefaultUpgradeTaskFactoryProcessor.performUpgradesUnsafe(DefaultUpgradeTaskFactoryProcessor.java:81)
at com.atlassian.upgrade.core.DefaultUpgradeTaskFactoryProcessor.performUpgrades(DefaultUpgradeTaskFactoryProcessor.java:46)
at com.atlassian.upgrade.core.DefaultUpgradeTaskManager.upgradeHostApp(DefaultUpgradeTaskManager.java:41)
at com.atlassian.jira.upgrade.LicenseCheckingUpgradeService.executeUpgrades(LicenseCheckingUpgradeService.java:134)
at com.atlassian.jira.upgrade.LicenseCheckingUpgradeService.runUpgrades(LicenseCheckingUpgradeService.java:97)
at com.atlassian.jira.upgrade.ClusterLockingUpgradeService.runUpgrades(ClusterLockingUpgradeService.java:35)
at com.atlassian.jira.upgrade.LoggingUpgradeService.lambda$runUpgradesWithLogging$0(LoggingUpgradeService.java:28)
at com.atlassian.jira.upgrade.LoggingUpgradeService.runWithTaskLogging(LoggingUpgradeService.java:43)
at com.atlassian.jira.upgrade.LoggingUpgradeService.runUpgradesWithLogging(LoggingUpgradeService.java:28)
at com.atlassian.jira.upgrade.IndexingUpgradeService.runUpgrades(IndexingUpgradeService.java:19)
at com.atlassian.jira.upgrade.DefaultUpgradeService.runUpgrades(DefaultUpgradeService.java:61)
at com.atlassian.jira.upgrade.UpgradeLauncher.upgradeIfNeeded(UpgradeLauncher.java:109)
at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:86)
at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:54)
at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:177)
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:150)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:305)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:202)
at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:141)
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:107)
at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:105)
at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:154)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: The provided cron string does not have 7 parts: 30 10,22 * * *
at com.atlassian.jira.web.component.cron.parser.CronExpressionParser.parseCronString(CronExpressionParser.java:285)
at com.atlassian.jira.web.component.cron.parser.CronExpressionParser.parseAndValidateCronString(CronExpressionParser.java:271)
at com.atlassian.jira.web.component.cron.parser.CronExpressionParser.<init>(CronExpressionParser.java:71)
at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build819000.changeCronToDaily(UpgradeTask_Build819000.java:109)
at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build819000.doUpgrade(UpgradeTask_Build819000.java:48)
at com.atlassian.jira.upgrade.AbstractUpgradeTask.runUpgrade(AbstractUpgradeTask.java:61)
... 35 more
2024-04-08 11:13:35,898+0100 JIRA-Bootstrap WARN [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Failed to complete upgrade task [factory=host,buildNumber=819000]
2024-04-08 11:13:35,900+0100 JIRA-Bootstrap INFO [c.a.j.upgrade.util.BuildNumberDao] Setting current build number to 815001
2024-04-08 11:13:35,901+0100 JIRA-Bootstrap ERROR [c.a.jira.upgrade.LicenseCheckingUpgradeService] There was an error running the upgrades
Cause
The root cause is not clear yet but there are problematic records in the ServiceConfig table. The records should have a minimum of 6 Cron parts, but some of them have less than 6. In most of the cases, it's because of the Index Snapshot Service.
Connect Jira database and run the query below to check the problematic records for the Index Snapshot Service:
select * from ServiceConfig where clazz like '%index%'
For a healthy record, it should be like this:
id | delaytime | clazz | servicename | cron_expression
-------+-----------+--------------------------------------------------+-----------------------------+-----------------
32881 | 86400000 | com.atlassian.jira.index.ha.IndexSnapshotService | JIRA Index Snapshot Service | 0 30 22 ? * *
This is what a problematic record looks like:
id | delaytime | clazz | servicename | cron_expression
-------+-----------+--------------------------------------------------+-----------------------------+-----------------
32880 | 86400000 | com.atlassian.jira.index.ha.IndexSnapshotService | JIRA Index Snapshot Service | 30 10,22 * * *
Solution:
- Stop Jira
- Delete the problematic record(s)
- Start Jira to finish upgrading