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

After successfully deleting custom fields on Jira Data Center some operations may result on NullPointerException on some nodes of the cluster

XMLWordPrintable

      Current Behavior

      After deleting a custom field, one or more nodes in JIRA Data Center show NullPointerException when searching for issues or when viewing issues.

      • NullPointerException may occur on other pages as well.

      Example stacktrace:

      com.atlassian.cache.CacheException: java.lang.NullPointerException
          at com.atlassian.cache.ehcache.DelegatingCache.get(DelegatingCache.java:104)
          at com.atlassian.jira.cache.DeferredReplicationCache.get(DeferredReplicationCache.java:48)
          at com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister.getConfigSchemesForCustomField(CachedFieldConfigSchemePersister.java:100)
          at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.getConfigSchemesForField(FieldConfigSchemeManagerImpl.java:48)
          at com.atlassian.jira.issue.fields.ImmutableCustomField.getConfigurationSchemes(ImmutableCustomField.java:1222)
          at com.atlassian.jira.jql.permission.CustomFieldClausePermissionChecker.hasPermissionToUseClause(CustomFieldClausePermissionChecker.java:44)
          at com.atlassian.jira.jql.permission.DefaultClausePermissionHandler.hasPermissionToUseClause(DefaultClausePermissionHandler.java:46)
          at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getVisibleClauseHandlers(DefaultSearchHandlerManager.java:186)
          at com.atlassian.jira.web.component.jql.DefaultAutoCompleteJsonGenerator.getVisibleFieldNamesJson(DefaultAutoCompleteJsonGenerator.java:70)
      ...
      Caused by: java.lang.NullPointerException
          at com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl.lambda$getConfigSchemesForCustomField$0(FieldConfigSchemePersisterImpl.java:202)
          at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
          at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
          at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
          at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
          at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
          at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
          at com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl.getConfigSchemesForCustomField(FieldConfigSchemePersisterImpl.java:205)
          at com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister.loadSchemesByCustomFieldId(CachedFieldConfigSchemePersister.java:207)
          at com.atlassian.cache.ehcache.LoadingCache.getFromLoader(LoadingCache.java:145)
          at com.atlassian.cache.ehcache.LoadingCache.loadValueAndReleaseLock(LoadingCache.java:100)
          at com.atlassian.cache.ehcache.LoadingCache.get(LoadingCache.java:76)
          at com.atlassian.cache.ehcache.DelegatingCache.get(DelegatingCache.java:99)
          ... 268 more
      

      Expected Results

      Deleting custom field does not cause errors on any node

      Cause

      The cause is believed to be a race condition where the cache on NPE nodes reference a custom field that no longer exists.

      Environment

      JIRA Data Center with two or more nodes

      Steps to reproduce

      1. Set breakpoint in DefaultSearchHandlerManager.java#getVisibleClauseHandlers
        • Line 186, pause thread
      2. Attempt to add issue link - From an issue, add link then add by searching for issues (so that JQL autocomplete will be retrieved)
        • Breakpoint is it.
      3. On another node, delete custom field
      4. On paused node, flush caches
      5. Mute breakpoints, run
        • Stacktrace in logs, unable to use JQL autocomplete

      Workaround

      Nodes showing NullPointerException will need to be restarted or have caches flushed. NullPointerException should not appear after restart.

      • Success has been reported when using ScriptRunner to flush caches
        • /plugins/servlet/scriptrunner/admin/builtin/exec/com.onresolve.scriptrunner.canned.jira.admin.JiraClearCaches
      • NullPointerException that continues after restart indicates a different problem is occurring

              Unassigned Unassigned
              tevans Tim Evans (Inactive)
              Votes:
              54 Vote for this issue
              Watchers:
              73 Start watching this issue

                Created:
                Updated: