-
Bug
-
Resolution: Fixed
-
High
-
6.3-OD-3, 6.3.3, 6.3.4
-
6.03
-
NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.
Next code will throw NPE:
if (!watchesByIssueId.get(issueId).equals(correctWatches)) { result.add(new BrokenIssue(issueId, correctWatches)); }
in case, that there is a watcher linked to an issue, which was already deleted. Because it will be not able to get necessary information from this issue.
Diagnosis
The following NullPointerException appears in $JIRA_HOME/log/atlassian-jira.log file:
2014-08-18 02:08:42,924 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ 2014-08-18 02:08:43,251 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: JRA-34394: Fixing incorrect watch count for cloned issues 2014-08-18 02:08:43,610 localhost-startStop-1 ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: null java.lang.NullPointerException at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:105) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:96) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:240) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.findBrokenIssues(UpgradeTask_Build6331.java:93) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.doUpgrade(UpgradeTask_Build6331.java:63) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:693) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:542) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:471) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:413) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:348) at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:106) at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:54) at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:42) at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:133) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:324) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:214) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:115) at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:78) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:73) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:71) <+5> (StandardContext.java:4939) (StandardContext.java:5434) (LifecycleBase.java:150) (ContainerBase.java:1559) (ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Workaround
This workaround involves executing SQL queries on the JIRA database and hence we recommend having/taking a backup of the database either using JIRA XML backup (before the upgrade) or using native database backup tools as a precaution.
- Stop JIRA.
- From the JIRA database, remove the 'WatchIssue' associations which reference non-existing issues using the following SQL query:
PostgreSQLdelete from "userassociation" where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from "jiraissue" issue );
Microsoft SQL Server
The following query assumes that you are using the schema jiraschema. If you use a different one, you would need to replace jiraschema with yours - you could find that out from $JIRA_HOME/dbconfig.xml file.delete from jiraschema.userassociation where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from jiraschema.jiraissue issue );
MySQL
Thanks to Leos Junek's comment belowDELETE FROM userassociation WHERE association_type = 'WatchIssue' AND sink_node_entity = 'Issue' AND sink_node_id NOT IN (SELECT issue.id FROM jiraissue issue);
Oracle
Thanks to Robert Heckel's comment belowdelete FROM userassociation where association_type = 'WatchIssue' and sink_node_entity = 'Issue' and sink_node_id not in ( select issue.id from jiraissue issue ); commit;
- Start JIRA.
- is duplicated by
-
JRASERVER-39982 NPE in Upgrade task of JRA-34394: Watch count gets out of sync when cloning issues
- Closed
- is related to
-
JRASERVER-40297 NPE in Upgrade task of JRA-34394: Vulnerable to data corruption
- Closed
-
JRASERVER-43461 Similar issue to super-task
- Closed
- relates to
-
JRACLOUD-39544 NPE in Upgrade task of JRA-34394: Watch count gets out of sync when cloning issues
- Closed
-
JRASERVER-34394 Watch count gets out of sync when cloning issues
- Closed
- mentioned in
-
Page Loading...