Memory problems with script runner

Hugo Mora June 9, 2015

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 votes
Hugo Mora June 10, 2015

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2015

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.

MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2015

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

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2015

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.

Hugo Mora June 10, 2015

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

Suggest an answer

Log in or Sign up to answer