Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to identify which ScriptRunner Groovy script is running from a Stracktrace or Thread dump

Rodrigo Martinez
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2022

Hi Community!

When troubleshooting slowness or contentions in Jira we usually rely on Thread dumps.

When there's a ScriptRunner Groovy script involved, it shows up in the Thread's Stracktrace in an aliased form:

Script2$_run_closure1.doCall(Script2.groovy:21)

My question is if there's a way to trace which script exactly is this "Script2". Are these aliases stored somewhere in the database, available through API or somewhere in the UI we learn which Groovy script is that?

Cheers!

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Ram Kumar Aravindakshan _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.
October 6, 2022

Hi @Rodrigo Martinez

If you are uncertain which code the error is pointing to, I suggest you look into the classes/ folder, i.e. <JIRA_HOME>/scriptrunner/classes/ folder, e.g. /var/lib/atlassian/application-data/jira/scriptrunner/classes/, search for the class file with that name there and try to decompile it.

Once you have the decompiled code, try to locate a similar code in your environment. You could use the Script Registry to perform the search.

I hope this helps to answer your question. :-)

Thank you and Kind regards,
Ram

Pankaj August 10, 2023

Hi Ram,

I am getting the same error in log files.

java.lang.NullPointerException
    at java_lang_String$concat$16.call(Unknown Source)
    at scripts.scriptedfields.GlobalActivityType$_run_closure1.doCall(GlobalActivityType.groovy:23)
    at scripts.scriptedfields.GlobalActivityType.run(GlobalActivityType.groovy:11)

 so, we also have to decompile "GlobalActivityType.groovy" file ?

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 10, 2023

GlobalActivityType.groovy is not a compiled script.

You should be able to find that right from the script editor.

There the issue arises when scripts are stored as "in-line script" in the various scriptrunner configuration. In those cases, the stack trace will include a randomly generated file name. In the example above "Script2.groovy".

Since there is no mapping of which randomly generated script name goes with which configuration, the only way is to look at the compiled .class file of the same name, decompile it, and try to look through existing scripts for similar logic.

TAGS
AUG Leaders

Atlassian Community Events