ScriptRunner barfs on reindexing

There are a few other 'answers' questions that mention this error. Mine is different enough that I thought I would post here. Basically, I have to disable ScriptRunner to reindex (after an upgrade).

2014-07-24 16:47:48,150 Thread-40 WARN      [onresolve.jira.groovy.ScriptManager
Impl] Failed to create searcher custom field. Can happen during upgrades.
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.N
ullPointerException
        at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyRefe
rence.java:149)
        at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:11
2)
        at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableL
azyReference.java:87)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.getCustomFieldSearche
r(CustomFieldImpl.java:1872)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImp
l.java:248)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImp
l.java:221)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFie
ldCache.cloneCustomFields(DefaultCustomFieldManager.java:762)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFie
ldCache.getAllCustomFields(DefaultCustomFieldManager.java:749)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CopyOnWri
teCustomFieldCache.getAllCustomFields(DefaultCustomFieldManager.java:642)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getAllCus
tomFields(DefaultCustomFieldManager.java:438)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustom
FieldObjects(DefaultCustomFieldManager.java:433)
        at com.atlassian.jira.issue.CustomFieldManager$getCustomFieldObjects.cal
l(Unknown Source)
        at com.onresolve.jira.groovy.ScriptManagerImpl.createIndexingCustomField
(ScriptManagerImpl.groovy:499)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurre
ntN(ScriptBytecodeAdapter.java:78)
        at com.onresolve.jira.groovy.ScriptManagerImpl.this$dist$invoke$1(Script
ManagerImpl.groovy)
        at com.onresolve.jira.groovy.ScriptManagerImpl$1.methodMissing(ScriptMan
agerImpl.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:811)

        at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
1103)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1056)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:137)
        at com.onresolve.jira.groovy.ScriptManagerImpl$1.run(ScriptManagerImpl.g
roovy:394)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at com.atlassian.jira.util.JiraUtils.loadComponent(JiraUtils.java:96)
        at com.atlassian.jira.util.JiraUtils.loadComponent(JiraUtils.java:91)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.loadSearc
her(DefaultCustomFieldManager.java:298)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustom
FieldSearcher(DefaultCustomFieldManager.java:277)
        at com.atlassian.jira.issue.fields.CustomFieldImpl$CustomFieldSearcherLa
zyRef.create(CustomFieldImpl.java:2176)
        at com.atlassian.jira.issue.fields.CustomFieldImpl$CustomFieldSearcherLa
zyRef.create(CustomFieldImpl.java:2156)
        at com.atlassian.util.concurrent.ResettableLazyReference$InternalReferen
ce.create(ResettableLazyReference.java:140)
        at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.ja
va:321)
        at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyRefe
rence.java:143)
        at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:11
2)
        at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableL
azyReference.java:87)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.getCustomFieldSearche
r(CustomFieldImpl.java:1872)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImp
l.java:248)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImp
l.java:221)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFie
ldCache.cloneCustomFields(DefaultCustomFieldManager.java:762)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFie
ldCache.getAllCustomFields(DefaultCustomFieldManager.java:749)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CopyOnWri
teCustomFieldCache.getAllCustomFields(DefaultCustomFieldManager.java:642)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getAllCus
tomFields(DefaultCustomFieldManager.java:438)
        at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustom
FieldObjects(DefaultCustomFieldManager.java:433)
        at com.atlassian.jira.issue.CustomFieldManager$getCustomFieldObjects.cal
l(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
teArray.java:42)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
llSite.java:112)
        at com.onresolve.jira.groovy.ScriptManagerImpl.createIndexingCustomField
(ScriptManagerImpl.groovy:499)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurre
ntN(ScriptBytecodeAdapter.java:78)
        at com.onresolve.jira.groovy.ScriptManagerImpl.this$dist$invoke$1(Script
ManagerImpl.groovy)
        at com.onresolve.jira.groovy.ScriptManagerImpl$1.methodMissing(ScriptMan
agerImpl.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
90)
        at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:811)

        at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:
1103)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1056)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(Po
goMetaClassSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Abs
tractCallSite.java:133)
        ... 3 more

Which leads to:

Error occurred while activating indexes: com.atlassian.jira.index.IndexingFailureException: Indexing completed with 52802 errors
com.atlassian.jira.index.IndexingFailureException: Indexing completed with 52232 errors
at com.atlassian.jira.index.AccumulatingResultBuilder$CompositeResult.await(AccumulatingResultBuilder.java:147)
at com.atlassian.jira.issue.index.DefaultIndexManager.doIndexIssuesInBatchMode(DefaultIndexManager.java:877)
at com.atlassian.jira.issue.index.DefaultIndexManager.doStopTheWorldReindex(DefaultIndexManager.java:844)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:307)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:272)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.$Proxy135.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:374)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:250)
at java.lang.Thread.run(Thread.java:745)

5 answers

0 vote

What was the latest version you upgraded to and saw this? I believe this is fixed in 3.0. If you have 6.2 or above, you can use 3.x (even though in marketplace it's only marked as compatible with 6.3).

Jamie, this was a problem when cloning 6.1.5 to a stage server. I was able to get around it by disabling Script Runner, performing the re-index, and then re-enabling the plugin after upgrading to 6.3.1. But, now I'm seeing the issue again. We are running 3.0.3 right now in JIRA 6.3.1.

0 vote

I'll have to get back to you when I am back from my holiday, late next week.

Adam, are you only seeing these errors after a restart?

Actually, I think I figured of a way to fix this last night. The problem was when cloning the intance to a new server. If I didn't disable Script Runner 2.1.16 in JIRA 6.1.5, it was unable to re-index. If I disabled it, whacked the index directory, and restarted JIRA I could then get it to re-index. But, even after upgrading both JIRA and Script Runner, I still saw the issues.

The solution seems to be to upgrade Script Runner DURING the cloning process to 3.0.0. Re-index works fine on the first try. Then, upgrade JIRA and all out-a-date plugins.

So you upgraded to Script Runner 3.0.0 in Jira 6.1.5, before you upgraded Jira? This could be good for us next year when we upgrade from 6.1.6.

Thats right....it's a manual upgrade and it will tell you that it is "Incompatible", but it works. You might see the auto re-index fail when it is performing upgrade tasks. But, if you restart JIRA, upgrade the plugins, and THEN do the re-index, it should be successful.

I don't really know how JIRA handles this, when it has a plugin that's incompatible with either the version of jira that will be upgraded, or the target version.

Personally in my production instances I remove all plugins, do the upgrade, then add the correct (newer) versions of the plugins back. This always works well for me, and lets me find issues causes by either plugins or jira itself separately.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you