Jira hangs in a post function script (script runner)

Hi, in a workflow transition i have two script post functions (script runner). The first one creates a new project, the second one creates an issue for that project.

but Jira stops working when creating the issue, I see no errors in the log, and when I execute the code in script console it works fine creating the project and its issue.

But in the transition jira stops working in the issueService.create sentence.

The log does not shows any error, but i have to stop jira and start it again. When I remove the post function that creates the issue, jira creates the project just fine and viceversa.

It seems to me that this is a lock problem or something like that. Can Anyone help me.

IssueService issueService = ComponentAccessor.getIssueService();

...

if (result.getErrorCollection().hasAnyErrors()) {

log.error(result.getErrorCollection())

}

issueService.create(asignado, result); (Here is where Jira hangs)

3 answers

1 accepted

Accepted Answer
0 votes

Hi, lost so much time trying to fix this problem by myself that at the end I had to find a quick solution, so what I did was that I left the script that creates a project in the transition and removed the post function that creates the issue.

Then I added another script post function at the end that does a fast-track transition (new transition) in which I added the script post function that creates de issue for the project.

The new transition starts and ends in the same step, it is only used to execute the script post function.

So I guess the problem has to do with the Database, as long as the transition doesn’t end the project is not really inserted (or needs a commit) and the issue can’t be added because of that.

Thanks

0 votes

When it's "locked", get a thread dump, using jstack or whatever. Post that, maybe we can work out what the problem is.

0 votes

You can create a project in a transition using this script: https://gist.github.com/jechlin/7198215

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

486 views 3 5
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