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

Delayed upgrade task can put the database in an invalid state.

    XMLWordPrintable

Details

    • Severity 1 - Critical
    • Hide
      Atlassian Update – 11 October 2019

      Hi everyone,

      After reviewing the overall customer interest and impact of this bug report we have decided to close this issue down. Our analysis has shown that over time this issue hasn't collected a significant number of votes, watchers, comments, or support cases from customers and therefore has remained very low on our priority list. Given these findings we can conclude it will not be fixed in the foreseeable future and wish to be transparent about our priorities by closing it as Timed Out.

      Although we're aware this issue may be still important to those of you who were involved in the initial conversations around it, we want to be clear by managing your expectations regarding the likelihood of a fix for it. The Jira team do their best to prioritise the issues that have high and critical impact with broad pervasiveness reflected in series of different factors. You can learn more about this by reading our Bug Fixing Policy.

      To see what the Jira team is currently working on and has recently delivered see the following dashboards:

      We understand that hearing a decision like this can be disappointing, but we hope you'll appreciate our transparent approach to product priorities and communications. We will continue to watch this issue for further updates, so please feel free to share any thoughts in the comments.

      Thank you,

      Pawel Drygas,

      Jira Server Bugmaster

      Show
      Atlassian Update – 11 October 2019 Hi everyone, After reviewing the overall customer interest and impact of this bug report we have decided to close this issue down. Our analysis has shown that over time this issue hasn't collected a significant number of votes, watchers, comments, or support cases from customers and therefore has remained very low on our priority list. Given these findings we can conclude it will not be fixed in the foreseeable future and wish to be transparent about our priorities by closing it as Timed Out . Although we're aware this issue may be still important to those of you who were involved in the initial conversations around it, we want to be clear by managing your expectations regarding the likelihood of a fix for it. The Jira team do their best to prioritise the issues that have high and critical impact with broad pervasiveness reflected in series of different factors. You can learn more about this by reading our Bug Fixing Policy . To see what the Jira team is currently working on and has recently delivered see the following dashboards: Jira Server and Data Center: Recently resolved issues Jira Server and Data Center: Current work and future plans Jira Server and Data Center: Bug Fix Board We understand that hearing a decision like this can be disappointing, but we hope you'll appreciate our transparent approach to product priorities and communications. We will continue to watch this issue for further updates, so please feel free to share any thoughts in the comments. Thank you, Pawel Drygas, Jira Server Bugmaster

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Summary

      If the jira instance is restarted after adding an entry for a delayed upgrade task in the database, but before it's complete, it can end up in an invalid state whereby on next boot, it will try to add the delayed upgrade task again and fail due to a public key conflict.

      Steps to Reproduce.

      1. Have a database with values from an older version of JIRA.
      2. Update to a version of JIRA where the last upgrade task is a delayed upgrade task.
      3. Stop jira after the entry has been added into the database about the upgrade task, but before it has completed.
      4. Try to start JIRA up again.

      Expected Results.

      JIRA starts up fine and the delayed upgrade task runs at the next reasonable time.

      Actual Results

      JIRA breaks and needs manual database entry changes before it'll work again.

      Notes

      log:

      
      @40000000578dad371fcc7ae4 2016-07-19 14:31:41,533 localhost-startStop-1 INFO      [c.a.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________
      @40000000578dad3a06c34ce4 2016-07-19 14:31:44,113 localhost-startStop-1 INFO      [c.a.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Populating entity_translation table
      @40000000578dad3a0ca8edbc 2016-07-19 14:31:44,212 localhost-startStop-1 INFO      [c.a.j.upgrade.tasks.UpgradeTask_Build100005] Migrated IssueType translations: count=2
      @40000000578dad3a0e38387c 2016-07-19 14:31:44,238 localhost-startStop-1 INFO      [c.a.j.upgrade.tasks.UpgradeTask_Build100005] Migrated CustomField translations: count=1
      @40000000578dad3a11153cd4 2016-07-19 14:31:44,280 localhost-startStop-1 ERROR      [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Populating entity_translation table to the upgrade history
      @40000000578dad3a1115488c com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,100005][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005][downgradetaskrequired,N][id,19900][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory"
      @40000000578dad3a111592c4   Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.))
      @40000000578dad3a111596ac 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
      @40000000578dad3a11159a94 	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
      @40000000578dad3a11159e7c 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:855)
      @40000000578dad3a1115b204 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:722)
      @40000000578dad3a1115b5ec 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:605)
      @40000000578dad3a1115b9d4 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:489)
      @40000000578dad3a1115bdbc 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:431)
      @40000000578dad3a1115c58c 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:375)
      @40000000578dad3a1115c974 	at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:90)
      @40000000578dad3a1115cd5c 	at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:47)
      @40000000578dad3a1115d144 	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:46)
      @40000000578dad3a1115d914 	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:178)
      @40000000578dad3a1115dcfc 	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$572/18195594.run(Unknown Source)
      @40000000578dad3a1115f084 	at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StartupTask.run(DefaultInstantUpgradeManager.java:139)
      @40000000578dad3a1115f46c 	at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:55)
      @40000000578dad3a1115f854 	at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:42)
      @40000000578dad3a1116040c 	at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:171)
      @40000000578dad3a1116040c 	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:159)
      @40000000578dad3a111607f4 	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$571/15549038.run(Unknown Source)
      @40000000578dad3a111613ac 	at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55)
      @40000000578dad3a11161794 	at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:156)
      @40000000578dad3a11161b7c 	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:145)
      @40000000578dad3a11161f64 	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$16/1490463.run(Unknown Source)
      @40000000578dad3a1116522c 	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
      @40000000578dad3a11165614 	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194)
      @40000000578dad3a111659fc 	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:135)
      @40000000578dad3a111665b4 	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:101)
      @40000000578dad3a1116699c 	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$4/3748190.run(Unknown Source)
      @40000000578dad3a11166d84 	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
      @40000000578dad3a11166d84 	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:99)
      @40000000578dad3a1116793c 	at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:146)
      @40000000578dad3a11167d24 	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:94)
      @40000000578dad3a1116810c 	... 8 filtered
      @40000000578dad3a1116810c 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      @40000000578dad3a111690ac 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      @40000000578dad3a111690ac 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      @40000000578dad3a11169494 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      @40000000578dad3a1116987c 	at java.lang.Thread.run(Thread.java:745)
      @40000000578dad3a1116987c Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,100005][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005][downgradetaskrequired,N][id,19900][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory"
      @40000000578dad3a1116afec   Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.))
      @40000000578dad3a1116b3d4 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213)
      @40000000578dad3a1116b7bc 	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178)
      @40000000578dad3a1116c75c 	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
      @40000000578dad3a1116c75c 	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556)
      @40000000578dad3a1116cb44 	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97)
      @40000000578dad3a1116cf2c 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
      @40000000578dad3a1116cf2c 	... 44 more
      @40000000578dad3a1116dae4 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory"
      @40000000578dad3a1116e2b4   Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.)
      @40000000578dad3a1116e69c 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683)
      @40000000578dad3a1116f254 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205)
      @40000000578dad3a1116f254 	... 50 more
      @40000000578dad3a1116f63c Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_upgradehistory"
      @40000000578dad3a111705dc 	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
      @40000000578dad3a111709c4 	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
      @40000000578dad3a11170dac 	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
      @40000000578dad3a11170dac 	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
      @40000000578dad3a1117251c 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
      @40000000578dad3a11172904 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
      @40000000578dad3a11172cec 	... 2 filtered
      @40000000578dad3a11172cec 	at java.lang.reflect.Method.invoke(Method.java:497)
      @40000000578dad3a111730d4 	at com.github.gquintana.metrics.proxy.MethodInvocation.proceed(MethodInvocation.java:75)
      @40000000578dad3a11173c8c 	at com.github.gquintana.metrics.sql.PreparedStatementProxyHandler.execute(PreparedStatementProxyHandler.java:55)
      @40000000578dad3a11174074 	at com.github.gquintana.metrics.sql.AbstractStatementProxyHandler.invoke(AbstractStatementProxyHandler.java:61)
      @40000000578dad3a1117445c 	at com.github.gquintana.metrics.proxy.ProxyHandler.invoke(ProxyHandler.java:73)
      @40000000578dad3a1117445c 	at com.sun.proxy.$Proxy3.executeUpdate(Unknown Source)
      @40000000578dad3a11175bcc 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      @40000000578dad3a11175fb4 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      @40000000578dad3a1117639c 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673)
      @40000000578dad3a11176784 	... 51 more
      @40000000578dad3a11dc326c 2016-07-19 14:31:44,299 localhost-startStop-1 ERROR      [c.a.jira.upgrade.UpgradeManagerImpl] Errors occurred during upgrade:
      @40000000578dad3a11ddc8ac 2016-07-19 14:31:44,299 localhost-startStop-1 ERROR      [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Populating entity_translation table to the Upgrade History. This means the state of the system may be out of sync with the upgrade history, which could result in missed downgrade tasks for future exports.
      

      Workaround:

      Deleting the entry in upgradehistory and restarting the instance makes it start up fine.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aradu aradu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: