Memory problems with script runner

Hi!

We are getting a strange error on our JIRA instance. JIRA is creating a very large object that crashes JIRA instance after GC timeout... 

We have detect a lot of threads with this stack trace.

Could you please review this error?

Thanks a lot,

--Hugo

 

http-bio-8080-exec-85
  at java.lang.StringCoding$StringDecoder.decode([BII)[C (Unknown Source)
  (...)
  at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction.getIssues(Ljava/lang/String;Lorg/apache/lucene/search/Query;)Ljava/util/List; (AbstractScriptedJqlFunction.groovy:74)
  at sun.reflect.GeneratedMethodAccessor2154.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (PogoMetaMethodSite.java:226)
  at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(Lgroovy/lang/GroovyObject;[Ljava/lang/Object;)Ljava/lang/Object; (PogoMetaMethodSite.java:52)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(Lgroovy/lang/GroovyObject;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (AbstractCallSite.java:145)
  at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction.getIssues(Ljava/lang/String;)Ljava/util/List; (Unknown Source)
  at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction$getIssues.callCurrent(Lgroovy/lang/GroovyObject;Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at com.onresolve.jira.groovy.jql.EntityMatch.getQuery(Lcom/atlassian/jira/jql/query/QueryCreationContext;Lcom/atlassian/query/operand/FunctionOperand;Lcom/atlassian/query/clause/TerminalClause;)Lorg/apache/lucene/search/Query; (script14333834963861257966674.groovy:88)
  at com.onresolve.jira.groovy.jql.EntityMatch$getQuery.call(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at com.onresolve.jira.groovy.jql.ScriptedJqlFunction.getQuery(Lcom/atlassian/jira/jql/query/QueryCreationContext;Lcom/atlassian/query/operand/FunctionOperand;Lcom/atlassian/query/clause/TerminalClause;)Lorg/apache/lucene/search/Query; (ScriptedJqlFunction.groovy:131)
  at com.onresolve.jira.groovy.jql.ScriptedJqlFunction$getQuery$0.call(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
  at com.onresolve.jira.groovy.jql.ScriptedFunctionClauseFactory.getQuery(Lcom/atlassian/jira/jql/query/QueryCreationContext;Lcom/atlassian/query/clause/TerminalClause;)Lcom/atlassian/jira/jql/query/QueryFactoryResult; (ScriptedFunctionClauseFactory.groovy:52)

2 answers

0 vote

Script-runner itself will not cause memory errors (unless you've got too little memory to load it in the first place, but that would apply with any addon).  It's what you do with it that matters.

You'll need to take a close look at the query that your users are triggering to work out what it is doing here.

Hi Nic, Heap is setup with 4 GB. I think that we have located the function on the JQL. I will update this issue. Thanks, --Hugo

Hi!

More info about this issue

We have reproduce the error on a side environment, using a JQL like this:

{code}

project = PROYECT1 AND "CustomFieldA" in (VALUE1,VALUE2, VALUE3) AND issueFunction in issueFieldMatch("", labels, "1.61.0") ORDER BY updated DESC

{code}
We have desactivated module "Scripted JQL Function" (scripted-jql-function) and there's no fail at this moment.
Cheers,
--Hugo

That would make sense - the "" in the issueFieldMatch means "read every issue in JIRA" - that's going to be a disaster in terms of performance in any medium to large JIRA installation.

You should be able to get this to work by replacing "" with a better restricting JQL query

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
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

174 views 1 17
Join discussion

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