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

Reindex fails because of NPE thrown by CustomFieldValues due to NULL value

XMLWordPrintable

      Issue Summary

      For customers having any records in customfieldvalue DB table with customfield value set to null, the reindex will stop with the error.

      Note: We expect a small number of instances suffering from this problem (as values should be assigned to custom fields to be correctly processed). However, the severity is critical as there is no workaround when it occurs (besides removing corrupted data if they are not used).

      Steps to Reproduce

      1. Have records in customfieldvalue table with a null value for customfield column
      2. Got to System->Indexing and trigger reindex (background or full)

      Expected Results

      Reindex finished without any errors.

      Actual Results

      Reindex finished with the error: The re-index did not complete successfully. Please refer to Jira logs for more details.

      The below exception is thrown in the atlassian-jira.log file:

      2020-09-22 18:19:00,614+0200 IssueIndexer:thread-19 WARN admin 1098x664x1 16c15lx 10.1.1.1 /secure/admin/IndexReIndex!reindex.jspa [c.a.jira.index.AccumulatingResultBuilder] 
      java.lang.NullPointerException: element cannot be mapped to a null key
      java.lang.RuntimeException: java.lang.NullPointerException: element cannot be mapped to a null key
      
      at com.atlassian.jira.index.DefaultIndex$Failure.<init>(DefaultIndex.java:100)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.lambda$perform$6(DefaultIssueIndexer.java:858)
      at java.util.HashMap.forEach(HashMap.java:1289)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.perform(DefaultIssueIndexer.java:858)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$processBatch$2(DefaultIssueIndexer.java:334)
      at com.atlassian.jira.index.SimpleIndexingStrategy.apply(SimpleIndexingStrategy.java:7)
      at com.atlassian.jira.index.SimpleIndexingStrategy.apply(SimpleIndexingStrategy.java:5)
      at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:47)
      at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:43)
      at com.atlassian.jira.util.concurrent.BoundedExecutor$2.call(BoundedExecutor.java:68)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
      
      Caused by: java.lang.NullPointerException: element cannot be mapped to a null key
      at java.util.Objects.requireNonNull(Objects.java:228)
      at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
      at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      at com.atlassian.jira.issue.customfields.persistence.CustomFieldValues.fromOrderedByUpdate(CustomFieldValues.java:29)
      at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.lambda$getValues$0(EagerLoadingOfBizCustomFieldPersister.java:88)
      at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
      at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1699)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.getValues(EagerLoadingOfBizCustomFieldPersister.java:88)
      ...
      at com.atlassian.jira.issue.customfields.DefaultNonNullCustomFieldProvider.getCustomFieldInfo(DefaultNonNullCustomFieldProvider.java:41)
      at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$IdentityBasedProvider.getCustomFieldInfo(DefaultIssueDocumentFactory.java:257)
      at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.lambda$getPersistedFieldsWithData$3(DefaultIssueDocumentFactory.java:167)
      at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
      at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
      at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.getPersistedFieldsWithData(DefaultIssueDocumentFactory.java:171)
      at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.createDocuments(DefaultIssueDocumentFactory.java:102)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer$DefaultDocumentCreationStrategy.get(DefaultIssueIndexer.java:1332)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssuesOperation.createDocuments(DefaultIssueIndexer.java:982)
      at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.perform(DefaultIssueIndexer.java:847)
      ... 10 more
      
      • Note: "Caused by: java.lang.NullPointerException: element cannot be mapped to a null key"

      Workaround

      • Validate where corrupted data come from and if you need them (like 'SELECT * from customfieldvalue WHERE customfield is null')
      • If you don't need these data, make DB backup and delete rows returned by the previous query.
      • If for some reasons you are not able to wipe them out, please upgrade to LTS release where this problem is solved.

              dkedzierski DK
              dkedzierski DK
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: