Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-7126

Upgrading Jira Service Management to version 4.15 might have an upgrade task failing

XMLWordPrintable

      Issue Summary

      Jira Service Management (JSM) 4.15.0 has an upgrade task named AUT_0014_FixSearchTemplateOnChangeDates which targets two Custom Fields from the IT service management project template:

      • Change completion date
      • Change start date



      If a project was created using this template and one of these custom fields were deleted, then the upgrade task will fail.
      The upgrade will still continue and complete, but every time the instance is restarted, Jira will try to run the upgrade task, which would continue to fail.

      If upgrading Jira Data Center using the Zero Downtime feature, then you won't be able to leave the upgrade mode while the upgrade task fails.

      Steps to Reproduce

      1. Install a fresh instance of Jira Service Management on version 4.14.0.
      2. Create a sample project using the IT service management template.
      3. Go to the Custom fields administration page and delete the following custom fields.
        • Change completion date
        • Change start date
      4. Upgrade Jira Service Management to version 4.15.0.
      5. Start Jira after the upgrade so it runs the upgrade tasks.

      Expected Results

      The upgrade completes successfully without any error.
      AUT_0014_FixSearchTemplateOnChangeDates detects the custom fields don't exist, although the project template is in use, and deals gracefully with it.

      Actual Results

      The upgrade completes, but the AUT_0014_FixSearchTemplateOnChangeDates upgrade task fails.
      The following is logged in the application log (atlassian-jira.log):

      2021-02-19 11:50:30,371-0300 Caesium-1-1 INFO      [c.a.jira.upgrade.UpgradeScheduler] JIRA upgrades completed successfully
      2021-02-19 11:50:30,376-0300 Caesium-1-1 INFO      [c.a.s.bootstrap.upgrade.ServiceDeskUpgradeTaskFactory] Converting JSD Async Upgrade tasks to the Upgrade Task Framework format.
      2021-02-19 11:50:30,408-0300 Caesium-1-1 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Starting upgrade task 'AUT_0014_FixSearchTemplateOnChangeDates' (AUT_0014_FixSearchTemplateOnChangeDates), build number: 14
      2021-02-19 11:50:30,412-0300 Caesium-1-1 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Commencing the AUT_0014 fix on search template change dates upgrade task. Attempt 1
      2021-02-19 11:50:30,413-0300 Caesium-1-1 ERROR      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Upgrade task 'class com.atlassian.servicedesk.bootstrap.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates' failed with with outcome 'FAILED': No matching custom field found for Change start date on attempt 1. No matching custom field found for Change completion date on attempt 1.
      2021-02-19 11:50:30,415-0300 Caesium-1-1 ERROR      [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Upgrade task [com.atlassian.servicedesk,buildNumber=14] failed
      java.lang.RuntimeException: Upgrade task 'class com.atlassian.servicedesk.bootstrap.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates' failed with with outcome 'FAILED': No matching custom field found for Change start date on attempt 1. No matching custom field found for Change completion date on attempt 1.
      	at com.atlassian.servicedesk.bootstrap.upgrade.ServiceDeskUpgradeTaskFactory$AsyncUpgradeTaskAdapter.runUpgrade(ServiceDeskUpgradeTaskFactory.java:120)
      	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.lambda$upgradePlugins$0(DefaultUpgradeTaskManager.java:54)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:541)
      	at com.atlassian.upgrade.core.DefaultUpgradeTaskManager.upgradePlugins(DefaultUpgradeTaskManager.java:55)
      	at com.atlassian.jira.upgrade.PluginUpgradeManager.upgradePlugins(PluginUpgradeManager.java:63)
      	at com.atlassian.jira.upgrade.UpgradeScheduler.runPluginUpgrades(UpgradeScheduler.java:103)
      	at com.atlassian.jira.upgrade.UpgradeScheduler.runUpgrades(UpgradeScheduler.java:78)
      	at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
      	at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
      	at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
      	at java.lang.Thread.run(Thread.java:748)
      2021-02-19 11:50:30,421-0300 Caesium-1-1 WARN      [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Failed to complete upgrade task [factory=com.atlassian.servicedesk,buildNumber=14]
      2021-02-19 11:50:30,424-0300 Caesium-1-1 DEBUG      [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] getService bundle [com.atlassian.audit.atlassian-audit-plugin]
      2021-02-19 11:50:30,443-0300 Caesium-1-1 INFO      [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Upgrade task [factory=com.atlassian.audit.atlassian-audit-plugin,buildNumber=3] completed in 19 milliseconds
      2021-02-19 11:50:30,444-0300 Caesium-1-1 ERROR      [c.a.jira.upgrade.UpgradeScheduler] Error occurred during execution of upgrades 
      com.atlassian.jira.upgrade.UpgradeException
       * Plugin upgrade(s) failed
      	at com.atlassian.jira.upgrade.UpgradeScheduler.runPluginUpgrades(UpgradeScheduler.java:106)
      	at com.atlassian.jira.upgrade.UpgradeScheduler.runUpgrades(UpgradeScheduler.java:78)
      	at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
      	at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
      	at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
      	at java.lang.Thread.run(Thread.java:748)
      2021-02-19 11:50:30,812-0300 Caesium-1-1 DEBUG      [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] getService bundle [com.atlassian.servicedesk.servicedesk-notifications-plugin]
      



      Each time Jira is restarted it will try to run the upgrade task and fail with similar log entries.

      2021-02-19 11:55:59,862-0300 Caesium-1-3 INFO      [c.a.jira.upgrade.UpgradeScheduler] JIRA upgrades completed successfully
      2021-02-19 11:55:59,866-0300 Caesium-1-3 INFO      [c.a.s.bootstrap.upgrade.ServiceDeskUpgradeTaskFactory] Converting JSD Async Upgrade tasks to the Upgrade Task Framework format.
      2021-02-19 11:55:59,879-0300 Caesium-1-3 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Starting upgrade task 'AUT_0014_FixSearchTemplateOnChangeDates' (AUT_0014_FixSearchTemplateOnChangeDates), build number: 14
      2021-02-19 11:55:59,887-0300 Caesium-1-3 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Commencing the AUT_0014 fix on search template change dates upgrade task. Attempt 2
      2021-02-19 11:55:59,887-0300 Caesium-1-3 ERROR      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Upgrade task 'class com.atlassian.servicedesk.bootstrap.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates' failed with with outcome 'FAILED': No matching custom field found for Change start date on attempt 2. No matching custom field found for Change completion date on attempt 2.
      2021-02-19 11:55:59,893-0300 Caesium-1-3 ERROR      [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Upgrade task [com.atlassian.servicedesk,buildNumber=14] failed
      java.lang.RuntimeException: Upgrade task 'class com.atlassian.servicedesk.bootstrap.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates' failed with with outcome 'FAILED': No matching custom field found for Change start date on attempt 2. No matching custom field found for Change completion date on attempt 2.
      	at com.atlassian.servicedesk.bootstrap.upgrade.ServiceDeskUpgradeTaskFactory$AsyncUpgradeTaskAdapter.runUpgrade(ServiceDeskUpgradeTaskFactory.java:120)
      
      (...)
      

      Workaround

      Create a new IT service management project and restart Jira so it runs the upgrade tasks during startup.
      If Jira was upgraded using Zero downtime, then you will need to click on Run upgrade tasks tasks button in the Jira upgrades page after restarting your instance.

      The following entries in the application log confirm the upgrade task completed successfully.

      2021-02-19 12:24:13,156-0300 Caesium-1-3 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Starting upgrade task 'AUT_0014_FixSearchTemplateOnChangeDates' (AUT_0014_FixSearchTemplateOnChangeDates), build number: 14
      2021-02-19 12:24:13,159-0300 Caesium-1-3 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Commencing the AUT_0014 fix on search template change dates upgrade task. Attempt 2
      2021-02-19 12:24:13,159-0300 Caesium-1-3 INFO      [c.a.s.b.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates] Upgrade task 'class com.atlassian.servicedesk.bootstrap.upgrade.tasks.AUT_0014_FixSearchTemplateOnChangeDates' applied successfully
      2021-02-19 12:24:13,176-0300 Caesium-1-3 INFO      [c.a.upgrade.core.DefaultUpgradeTaskFactoryProcessor] Upgrade task [factory=com.atlassian.servicedesk,buildNumber=14] completed in 36 milliseconds
      2021-02-19 12:24:13,177-0300 Caesium-1-3 INFO      [c.a.jira.upgrade.UpgradeScheduler] Plugins upgrades completed successfully
      

              Unassigned Unassigned
              tmasutti Thiago Masutti
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: