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

Assets upgrade from JSM below 5.12.x failed with NullPointerException if an import configuration has an invalid status of -1

XMLWordPrintable

      Issue Summary

      Assets upgrade failed with NullPointerException: Cannot invoke "com.riadalabs.jira.plugins.insight.services.imports.model.ImportSource.getId()"

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Upgrade from a JSM version < 5.12.x to 5.12.x or above.
      2. Verify if the Assets upgrade tasks number 89 and 90 succeeded.

      Expected Results

      In the atlassian-jira.log, we can see that both upgrade tasks with buildNumber = 89 and 90 finished.

      2024-05-22 08:47:40,116+0300 main INFO      [c.r.j.plugins.insight.upgrade] =========================================
      2024-05-22 08:47:40,116+0300 main INFO      [c.r.j.plugins.insight.upgrade] Starting upgrade task (buildNumber=89) : Encrypts all the passwords inside the json configurations (AO_8542F1_IFJ_IMPORT_SRC, AO_8542F1_IFJ_ATM_RULE_AC)
      2024-05-22 08:47:40,225+0300 main DEBUG      [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] getService bundle [com.riadalabs.jira.plugins.insight]
      2024-05-22 08:47:40,610+0300 main INFO      [c.r.j.plugins.insight.upgrade] Upgrade task finished (buildNumber=89) : Encrypts all the passwords inside the json configurations (AO_8542F1_IFJ_IMPORT_SRC, AO_8542F1_IFJ_ATM_RULE_AC)
      2024-05-22 08:47:40,610+0300 main INFO      [c.r.j.plugins.insight.upgrade] =========================================
      2024-05-22 08:47:40,631+0300 main INFO      [c.r.j.plugins.insight.upgrade] =========================================
      2024-05-22 08:47:40,631+0300 main INFO      [c.r.j.plugins.insight.upgrade] Starting upgrade task (buildNumber=90) : Encrypts all the API keys inside the JSON configurations (AO_8542F1_IFJ_IMPORT_SRC, AO_8542F1_IFJ_ATM_RULE_AC)
      2024-05-22 08:47:41,076+0300 main INFO      [c.r.j.plugins.insight.upgrade] Upgrade task finished (buildNumber=90) : Encrypts all the API keys inside the JSON configurations (AO_8542F1_IFJ_IMPORT_SRC, AO_8542F1_IFJ_ATM_RULE_AC)
      

      Actual Results

      Users might experience some issues when browsing a schema or object. The below exceptions can be seen in the atlassian-jira.log.

      • The log is flooded with the message below.
        2024-05-13 13:35:46,103+0300 InsightLauncherThread WARN anonymous     [c.r.j.p.i.services.launcher.InsightLauncher] Waiting for Assets upgrade tasks. Current upgrade task number is 88
        
      • Occasionally you see the upgrade task number 89 started but eventually failed.
        2024-05-13 13:35:46,848+0300 main INFO anonymous     [c.r.j.plugins.insight.upgrade] Starting upgrade task (buildNumber=89) : Encrypts all the passwords inside the json configurations (AO_8542F1_IFJ_IMPORT_SRC, AO_8542F1_IFJ_ATM_RULE_AC)
        2024-05-13 13:35:47,002+0300 main ERROR anonymous     [c.a.s.core.upgrade.PluginUpgrader] Upgrade failed:
        java.lang.NullPointerException: Cannot invoke "com.riadalabs.jira.plugins.insight.services.imports.model.ImportSource.getId()" because "bean" is null
        	at com.riadalabs.jira.plugins.insight.services.core.dal.impl.ImportSourceConfigurationDalImpl.storeImportSource(ImportSourceConfigurationDalImpl.java:214)
        	at com.riadalabs.jira.plugins.insight.upgrade.AssetsUpgradeTask089.encryptImportSourceConfigurations(AssetsUpgradeTask089.kt:48)
        	at com.riadalabs.jira.plugins.insight.upgrade.AssetsUpgradeTask089.performUpgrade$lambda-0(AssetsUpgradeTask089.kt:34)
        ...
        
      • A validation error because of a value = -1 of an import source. In the stack trace, we can see that this error is thrown when attempting to run the upgrade task number 89.
        2024-05-13 12:38:30,339+0300 UpmAsynchronousTaskManager:thread-1 ERROR admin     [c.r.j.p.i.s.c.dal.impl.ImportSourceConfigurationDalImpl] Unable to assemble ImportSource with id 1
        com.riadalabs.jira.plugins.insight.common.exception.ValidationInsightSystemException: ValidationInsightSystemException: Validation errors were found: noContext: ErrorMessage{i18nKey='Invalid type supplied -1', parameters=[], additionalMessage=null}; 
        	at com.riadalabs.jira.plugins.insight.services.imports.model.importsource.ConfigurationStatusType.from(ConfigurationStatusType.java:31)
        	at com.riadalabs.jira.plugins.insight.services.core.dal.impl.ImportSourceConfigurationDalImpl.assembleImportSource(ImportSourceConfigurationDalImpl.java:616)
        	at com.riadalabs.jira.plugins.insight.services.core.dal.impl.ImportSourceConfigurationDalImpl.findAllImportSources(ImportSourceConfigurationDalImpl.java:97)
        	at com.riadalabs.jira.plugins.insight.upgrade.AssetsUpgradeTask089.encryptImportSourceConfigurations(AssetsUpgradeTask089.kt:46)
        	at com.riadalabs.jira.plugins.insight.upgrade.AssetsUpgradeTask089.performUpgrade$lambda-0(AssetsUpgradeTask089.kt:34)
        
      • In the database, we can see that the ImportSource with ID 1 (as indicated in the error above) does have a Status value = -1, which is matching the validation error.
        select * from "AO_8542F1_IFJ_IMPORT_SRC" where "ID" = 1
        
        CREATED                |DATE_FORMAT|DATE_TIME_FORMAT|DEFAULT_CONCATENATOR|DEFAULT_EMPTY_VALUES|DEFAULT_UNKNOWN_VALUES|DESCRIPTION|ID|IMPORT_SOURCE_MODULE_KEY|JSON_CONFIGURATION                                                  |MODULE_VERSION|NAME                                   |OBJECT_SCHEMA_ID|RUN_AS_USER_KEY|STATUS|SYNCHRONIZATION|SYNCHRONIZATION_ENABLED|UPDATED                |
        -----------------------+-----------+----------------+--------------------+--------------------+----------------------+-----------+--+------------------------+--------------------------------------------------------------------+--------------+---------------------------------------+----------------+---------------+------+---------------+-----------------------+-----------------------+
        2024-04-09 21:54:37.212|           |                |-                   |                   1|                     1|           | 1|insight-discovery-import|{"directory":"/Users/michin/Downloads/disco-blitz","zipPassword":""}|             1|Migrated Discovery import configuration|               1|JIRAUSER10000  |    -1|0 0 1 * * ?    |true                   |2024-05-21 22:54:05.151|
        
        • The offending import source usually does not have an associated row in the AO_8542F1_IFJ_IMPORT_SRC_OT and AO_8542F1_IFJ_IMPORT_SRC_OTA tables. You can use the SQL queries below to check.
          select * from "AO_8542F1_IFJ_IMPORT_SRC_OT" where "IMPORT_SOURCE_ID" = 1
          
          select * from "AO_8542F1_IFJ_IMPORT_SRC_OTA" where "IMPORT_SOURCE_OTID" = (select "ID" from "AO_8542F1_IFJ_IMPORT_SRC_OT" where "IMPORT_SOURCE_ID" = 1)
          

      Workaround

      Remove the offending import configuration from the database and restart Jira.
      Please back up the instance before running this DELETE statement. It's also recommended to test this procedure in a non-production environment where the same issue can be reproduced before appplying it to a production environment.

      delete from "AO_8542F1_IFJ_IMPORT_SRC" where "Status" = -1;
      

              4efd9de64ab4 Mingyi Yang
              michin Michelle Chin (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: