Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-8703

Attempting to Index with JIRA Agile(GreenHopper) enabled throws a UndeclaredThrowableException or a NullPointerException

      Summary

      Attempting to index JIRA throws an exception when JIRA Agile (GreenHopper) is enabled.

      Steps to Reproduce

      1. Restore a "broken" data-set using the database backup (as XML restore fixes this).
      2. Index JIRA.

      Expected Results

      It completes without error.

      Actual Results

      The index fails with the below exception:

      java.util.concurrent.ExecutionException: java.lang.reflect.UndeclaredThrowableException
      Task completed in 12 seconds with unexpected error.
      Started Today 2:32 PM.
      Finished Today 2:32 PM.
      java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.reflect.UndeclaredThrowableException
      	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35)
      	at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.doIndexIssuesInBatchMode(DefaultIndexManager.java:855)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.doStopTheWorldReindex(DefaultIndexManager.java:825)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:335)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:301)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:81)
      	at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28)
      	at $Proxy157.reIndexAll(Unknown Source)
      	at com.atlassian.jira.util.index.CompositeIndexLifecycleManager.reIndexAll(CompositeIndexLifecycleManager.java:54)
      	at com.atlassian.jira.web.action.admin.index.ReIndexAsyncIndexerCommand.doReindex(ReIndexAsyncIndexerCommand.java:28)
      	at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:54)
      	at com.atlassian.jira.web.action.admin.index.ReIndexAsyncIndexerCommand.call(ReIndexAsyncIndexerCommand.java:16)
      	at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:23)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:366)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
      	at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
      	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.util.concurrent.ExecutionException: java.lang.reflect.UndeclaredThrowableException
      	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:83)
      	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
      	... 27 more
      Caused by: java.lang.reflect.UndeclaredThrowableException
      	at $Proxy1775.getSprint(Unknown Source)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.convertDbValueToType(SprintCFType.java:271)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.convertDbValueToType(SprintCFType.java:42)
      	at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.convertDbObjectToTypes(AbstractMultiCFType.java:232)
      	at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.getValueFromIssue(AbstractMultiCFType.java:160)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:231)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:42)
      	at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:384)
      	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistoryForIssue(SprintHistoryEntryFactory.java:133)
      	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistory(SprintHistoryEntryFactory.java:42)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFields(SprintCustomFieldIndexer.java:45)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFieldsSearchable(SprintCustomFieldIndexer.java:30)
      	at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46)
      	at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:11)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:598)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:593)
      	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:315)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy.get(DefaultIssueIndexer.java:592)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IndexIssuesOperation.perform(DefaultIssueIndexer.java:446)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:284)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:280)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:9)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:5)
      	at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:38)
      	at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:35)
      	at com.atlassian.jira.util.concurrent.BoundedExecutor$2.call(BoundedExecutor.java:70)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
      	at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	... 1 more
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.activeobjects.tx.TransactionalProxy.invoke(TransactionalProxy.java:79)
      	at com.atlassian.activeobjects.tx.TransactionalProxy.invoke(TransactionalProxy.java:39)
      	... 35 more
      Caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
      	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:152)
      	at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:115)
      	at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:89)
      	at com.atlassian.greenhopper.service.sprint.SprintManagerImpl.getSprint(SprintManagerImpl.java:68)
      	... 41 more
      Caused by: java.lang.NullPointerException
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
      	at com.google.common.collect.SingletonImmutableList.<init>(SingletonImmutableList.java:41)
      	at com.google.common.collect.ImmutableList.of(ImmutableList.java:80)
      	at net.java.ao.DatabaseProvider.renderAction(DatabaseProvider.java:244)
      	at net.java.ao.schema.SchemaGenerator$1.apply(SchemaGenerator.java:117)
      	at net.java.ao.schema.SchemaGenerator$1.apply(SchemaGenerator.java:114)
      	at com.google.common.collect.Iterators$8.next(Iterators.java:782)
      	at net.java.ao.schema.SchemaGenerator.migrate(SchemaGenerator.java:92)
      	at net.java.ao.EntityManager.migrate(EntityManager.java:133)
      	at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.migrate(EntityManagedActiveObjects.java:43)
      	at com.atlassian.activeobjects.internal.AbstractActiveObjectsFactory.create(AbstractActiveObjectsFactory.java:52)
      	at com.atlassian.activeobjects.internal.DelegatingActiveObjectsFactory.create(DelegatingActiveObjectsFactory.java:39)
      	at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory.createActiveObjects(ActiveObjectsServiceFactory.java:136)
      	at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory.access$000(ActiveObjectsServiceFactory.java:51)
      	at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$1$1.get(ActiveObjectsServiceFactory.java:65)
      	at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$1$1.get(ActiveObjectsServiceFactory.java:61)
      	at com.atlassian.activeobjects.osgi.DelegatingActiveObjects$MemoizingSupplier.get(DelegatingActiveObjects.java:149)
      	at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.find(DelegatingActiveObjects.java:76)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at $Proxy1764.find(Unknown Source)
      	at com.atlassian.greenhopper.service.sprint.SprintDao.loadAll(SprintDao.java:11)
      	at com.atlassian.greenhopper.service.sprint.SprintManagerImpl$1.create(SprintManagerImpl.java:52)
      	at com.atlassian.greenhopper.service.sprint.SprintManagerImpl$1.create(SprintManagerImpl.java:48)
      	at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:143)
      	at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:326)
      	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:146)
      	... 44 more
      

      OR

      java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
      	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35)
      	at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.doIndexIssuesInBatchMode(DefaultIndexManager.java:857)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.doStopTheWorldReindex(DefaultIndexManager.java:827)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:337)
      	at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:303)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:83)
      	at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28)
      	at com.sun.proxy.$Proxy129.reIndexAll(Unknown Source)
      	at com.atlassian.jira.util.index.CompositeIndexLifecycleManager.reIndexAll(CompositeIndexLifecycleManager.java:56)
      	at com.atlassian.jira.web.action.admin.index.ReIndexAsyncIndexerCommand.doReindex(ReIndexAsyncIndexerCommand.java:28)
      	at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:54)
      	at com.atlassian.jira.web.action.admin.index.ReIndexAsyncIndexerCommand.call(ReIndexAsyncIndexerCommand.java:16)
      	at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:23)
      	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:365)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
      	at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
      	at java.util.concurrent.FutureTask.get(Unknown Source)
      	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
      	... 25 more
      Caused by: java.lang.NullPointerException
      	at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.getValueFromIssue(AbstractMultiCFType.java:159)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:235)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:42)
      	at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:395)
      	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistoryForIssue(SprintHistoryEntryFactory.java:134)
      	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistory(SprintHistoryEntryFactory.java:54)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFields(SprintCustomFieldIndexer.java:45)
      	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFieldsSearchable(SprintCustomFieldIndexer.java:30)
      	at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46)
      	at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:41)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)
      	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:11)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:598)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:593)
      	at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:303)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy.get(DefaultIssueIndexer.java:592)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$IndexIssuesOperation.perform(DefaultIssueIndexer.java:446)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:284)
      	at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:280)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:9)
      	at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:5)
      	at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:38)
      	at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:35)
      	at com.atlassian.jira.util.concurrent.BoundedExecutor$2.call(BoundedExecutor.java:69)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	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)
      	... 1 more
      

      Workaround

      To workaround this:

      Step 1
      1. Disable JIRA Agile (GreenHopper) from 'Manage Add-ons'.
      2. Re-index data (this will succeed).
      3. Run the Database Integrity Checker and resolve all the errors shown.
      4. Re-enable JIRA Agile (GreenHopper).
      5. Re-index again (full re-index).
      Step 2 (if Step 1 does not resolve the issue)
      1. Create a new database and point JIRA to this db.
      2. Import a latest XML backup.

      Notes

      The second stack trace is caused by the issue being passed to getValueFromIssue in AbstractMultiCFType (in JIRA) being null. This is called from JIRA Agile's SprintCFType.getValueFromIssue method which checks for issue being a subtask first, so if the issue itself were null, it would have broken inside JIRA Agile code. It would appear that somehow sub-tasks are getting orphaned from their parent and this would cause these symptoms to occur.

          Form Name

            [JSWSERVER-8703] Attempting to Index with JIRA Agile(GreenHopper) enabled throws a UndeclaredThrowableException or a NullPointerException

            Jeff Turner added a comment - - edited

            I got this error with Agile 6.1.6 + JIRA 5.0.7 1. It was indeed caused by issuelink database records pointing to non-existent issues. The following SQL will identify any problems:

            jira507=# -- Identity broken subtask 'source' IDs
            jira507=# select issuelink.*, dstissue.pkey from issuelink LEFT JOIN jiraissue srcissue ON issuelink.source=srcissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN  jiraissue dstissue ON issuelink.destination=dstissue.id WHERE srcissue.id is null AND issuelinktype.linkname='jira_subtask_link';
            ┌───────┬──────────┬────────┬─────────────┬──────────┬─────────┐
            │  id   │ linktype │ source │ destination │ sequence │  pkey   │
            ├───────┼──────────┼────────┼─────────────┼──────────┼─────────┤
            │ 22349 │    10000 │  38723 │       38724 │        0 │ JTEST-7 │
            └───────┴──────────┴────────┴─────────────┴──────────┴─────────┘
            (1 row)
            jira507=# -- Identity broken subtask 'destination' IDs
            jira507=# select issuelink.*, srcissue.pkey from issuelink LEFT JOIN jiraissue dstissue ON issuelink.destination=dstissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN  jiraissue srcissue ON issuelink.source=srcissue.id WHERE dstissue.id is null AND issuelinktype.linkname='jira_subtask_link';
            ┌────┬──────────┬────────┬─────────────┬──────────┬──────┐
            │ id │ linktype │ source │ destination │ sequence │ pkey │
            ├────┼──────────┼────────┼─────────────┼──────────┼──────┤
            └────┴──────────┴────────┴─────────────┴──────────┴──────┘
            (0 rows)
            

            Broken links can be deleted with:

            jira507=# -- Delete the identified broken 'source' links
            jira507=# delete from issuelink where id in (select issuelink.id from issuelink LEFT JOIN jiraissue srcissue ON issuelink.source=srcissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN  jiraissue dstissue ON issuelink.destination=dstissue.id WHERE srcissue.id is null AND issuelinktype.linkname='jira_subtask_link');
            DELETE 1
            

            JIRA does not need to be restarted for this SQL to fix reindexing.

            [1]

            Caused by: java.lang.NullPointerException
            	at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.getValueFromIssue(AbstractMultiCFType.java:164)
            	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:235)
            	at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:42)
            	at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:362)
            	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistoryForIssue(SprintHistoryEntryFactory.java:133)
            	at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistory(SprintHistoryEntryFactory.java:53)
            	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFields(SprintCustomFieldIndexer.java:45)
            	at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFieldsSearchable(SprintCustomFieldIndexer.java:30)
            	at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46)
            	at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40)
            	at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)
            

            Jeff Turner added a comment - - edited I got this error with Agile 6.1.6 + JIRA 5.0.7 1 . It was indeed caused by issuelink database records pointing to non-existent issues. The following SQL will identify any problems: jira507=# -- Identity broken subtask ' source ' IDs jira507=# select issuelink.*, dstissue.pkey from issuelink LEFT JOIN jiraissue srcissue ON issuelink. source =srcissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN jiraissue dstissue ON issuelink.destination=dstissue.id WHERE srcissue.id is null AND issuelinktype.linkname= 'jira_subtask_link' ; ┌───────┬──────────┬────────┬─────────────┬──────────┬─────────┐ │ id │ linktype │ source │ destination │ sequence │ pkey │ ├───────┼──────────┼────────┼─────────────┼──────────┼─────────┤ │ 22349 │ 10000 │ 38723 │ 38724 │ 0 │ JTEST-7 │ └───────┴──────────┴────────┴─────────────┴──────────┴─────────┘ (1 row ) jira507=# -- Identity broken subtask 'destination' IDs jira507=# select issuelink.*, srcissue.pkey from issuelink LEFT JOIN jiraissue dstissue ON issuelink.destination=dstissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN jiraissue srcissue ON issuelink. source =srcissue.id WHERE dstissue.id is null AND issuelinktype.linkname= 'jira_subtask_link' ; ┌────┬──────────┬────────┬─────────────┬──────────┬──────┐ │ id │ linktype │ source │ destination │ sequence │ pkey │ ├────┼──────────┼────────┼─────────────┼──────────┼──────┤ └────┴──────────┴────────┴─────────────┴──────────┴──────┘ (0 rows ) Broken links can be deleted with: jira507=# -- Delete the identified broken ' source ' links jira507=# delete from issuelink where id in ( select issuelink.id from issuelink LEFT JOIN jiraissue srcissue ON issuelink. source =srcissue.id JOIN issuelinktype ON issuelink.linktype=issuelinktype.id JOIN jiraissue dstissue ON issuelink.destination=dstissue.id WHERE srcissue.id is null AND issuelinktype.linkname= 'jira_subtask_link' ); DELETE 1 JIRA does not need to be restarted for this SQL to fix reindexing. [1] Caused by: java.lang.NullPointerException at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.getValueFromIssue(AbstractMultiCFType.java:164) at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:235) at com.atlassian.greenhopper.customfield.sprint.SprintCFType.getValueFromIssue(SprintCFType.java:42) at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:362) at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistoryForIssue(SprintHistoryEntryFactory.java:133) at com.atlassian.greenhopper.customfield.sprint.SprintHistoryEntryFactory.getSprintChangeHistory(SprintHistoryEntryFactory.java:53) at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFields(SprintCustomFieldIndexer.java:45) at com.atlassian.greenhopper.customfield.sprint.SprintCustomFieldIndexer.addDocumentFieldsSearchable(SprintCustomFieldIndexer.java:30) at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46) at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40) at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)

            Gaj Umapathy added a comment - - edited

            Also affects Agile 6.3.2.2 on JIRA v6.1.7 -
            Update: - It looks like it was probably some other internal plugin that was causing this. I had the same error when I did the re-index with Agile disabled but it had less errors. Clearing cache folder etc didn't fix it. Finally running a full re-index under safe mode with all plugins disabled works fine. Now it's the question of find the culprit plugin(s).

            Gaj Umapathy added a comment - - edited Also affects Agile 6.3.2.2 on JIRA v6.1.7 - Update: - It looks like it was probably some other internal plugin that was causing this. I had the same error when I did the re-index with Agile disabled but it had less errors. Clearing cache folder etc didn't fix it. Finally running a full re-index under safe mode with all plugins disabled works fine. Now it's the question of find the culprit plugin(s).

            Dave C added a comment -

            Bugs relating to sub-tasks being orphaned have been linked to this issue as they may be related.

            Dave C added a comment - Bugs relating to sub-tasks being orphaned have been linked to this issue as they may be related.

            Go Hayama added a comment -

            Thanks, David. We appreciate it.

            Go Hayama added a comment - Thanks, David. We appreciate it.

            Dave C added a comment -

            rakuten I'll follow up with our devs on the support isssue we have raised. For anyone else watching this issue we'll update it with our findings.

            Dave C added a comment - rakuten I'll follow up with our devs on the support isssue we have raised. For anyone else watching this issue we'll update it with our findings.

            Go Hayama added a comment -

            dcurrie@atlassian.com,
            Sorry to bother you, but would it be possible to get your opinion on something?

            We just ran into this bug today, which we reported in the following support ticket:
            https://support.atlassian.com/browse/JSP-184611

            Because we were able to eventually rebuild our index successfully, and because we found that the underlying bug had already been registered here, we closed our support ticket, but we haven't done anything to address the cause of the problem, and considering that this is the second time we have run into this bug (and the second time our JIRA has been brought down as a result), I have to assume it's going to happen to us again.

            I understand that you're the reporter of this issue and not the assignee, but since I'm not sure where to direct this question, do you mind if I ask you?
            I'd like to get your opinion on what our best bet would be for preventing this problem from happening again on our instance.

            My thoughts are:

            1. This bug has been open since May of last year, and it only has 4 votes, so I'm guessing it's not going to get any attention. Is there any chance it will get looked at and resolved?
            2. JIRA Agile has had many upgrades since the time this bug was registered, but there is no 'Affects Version/s'. Is there any chance that if we upgrade to the latest version of JIRA Agile the problem might already be resolved? Our version of JIRA Agile is 6.2.5, and we can upgrade as far as 6.3.6.1 (since we're limited by being on JIRA 5.x).
            3. In our case, we resolved the problem by running JIRA's integrity checks (and fixing the resulting errors), and then re-indexing JIRA. If we were to make certain to do a JIRA integrity check before every JIRA re-index, would that perhaps be a viable workaround?

            If I should post this back in our support ticket (JSP-184611), please let me know.

            Thanks in advance for any thoughts you can share,
            Peter

            Go Hayama added a comment - dcurrie@atlassian.com , Sorry to bother you, but would it be possible to get your opinion on something? We just ran into this bug today, which we reported in the following support ticket: https://support.atlassian.com/browse/JSP-184611 Because we were able to eventually rebuild our index successfully, and because we found that the underlying bug had already been registered here, we closed our support ticket, but we haven't done anything to address the cause of the problem, and considering that this is the second time we have run into this bug (and the second time our JIRA has been brought down as a result), I have to assume it's going to happen to us again. I understand that you're the reporter of this issue and not the assignee, but since I'm not sure where to direct this question, do you mind if I ask you? I'd like to get your opinion on what our best bet would be for preventing this problem from happening again on our instance. My thoughts are: This bug has been open since May of last year, and it only has 4 votes, so I'm guessing it's not going to get any attention. Is there any chance it will get looked at and resolved? JIRA Agile has had many upgrades since the time this bug was registered, but there is no 'Affects Version/s'. Is there any chance that if we upgrade to the latest version of JIRA Agile the problem might already be resolved? Our version of JIRA Agile is 6.2.5, and we can upgrade as far as 6.3.6.1 (since we're limited by being on JIRA 5.x). In our case, we resolved the problem by running JIRA's integrity checks (and fixing the resulting errors), and then re-indexing JIRA. If we were to make certain to do a JIRA integrity check before every JIRA re-index, would that perhaps be a viable workaround? If I should post this back in our support ticket (JSP-184611), please let me know. Thanks in advance for any thoughts you can share, Peter

            Go Hayama added a comment - - edited

            We ran into this bug today, can anyone elaborate more about the "broken" dataset in steps to procedure?
            Do we have any plan to fix it?

            Thanks,
            Tom

            Go Hayama added a comment - - edited We ran into this bug today, can anyone elaborate more about the "broken" dataset in steps to procedure? Do we have any plan to fix it? Thanks, Tom

            Frank Stillone added a comment - - edited

            x

            Frank Stillone added a comment - - edited x

              Unassigned Unassigned
              dcurrie@atlassian.com Dave C
              Affected customers:
              6 This affects my team
              Watchers:
              14 Start watching this issue

                Created:
                Updated:
                Resolved: