jira groovy creation subtasks

I try to create 2 subtasks in groovy worflow postfunction.

The same groovy script leads to different results on 2 JIRA instances (the same version 6.3)

On JIRA1 - it's fine.

On JIRA2: it's hanging up.I got error as the result.

Actually subtask1 is created fine, but while creation of subtask2 it's hanging on

IssueService.IssueResult createResult = issueService.create(currentUser, validationResult);

and can't perform it

as I see it cannot get the next key in project

 

mysql admin shows that "UPDATE project .." is performing

java processes

 

   java.lang.Thread.State: WAITING (parking)

    at sun.misc.Unsafe.park(Native Method)

    - parking to wait for  <0x00000004d2b80630> (a java.util.concurrent.FutureTask)

    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)

    at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:425)

    at java.util.concurrent.FutureTask.get(FutureTask.java:187)

    at com.atlassian.jira.project.DefaultProjectManager$NextIdGenerator.getNextId(DefaultProjectManager.java:911)

 

and as result

java.util.concurrent.ExecutionException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while updating: [GenericEntity:Project][id,10532]

 

so seems transaction isolation level on JIRA1 and jira2 are not the same - but I'm not familiar to it at all

could you help please to find out how to fix it on jira2?

 

Thanks in advance.

5 answers

This widget could not be displayed.

Is it the same DBMS in both cases?

This widget could not be displayed.

different instances of mysql 5.6

This widget could not be displayed.

Searching the web I can only see this problem in relation to mysql, although older versions of jira. Have you asked Atlassian support? Do you get this problem only when programatically creating issues? Can you post the full script?

This widget could not be displayed.

I haven't asked Atlassian yet - it looks like the reason is obvious - but I can't see it unfortunatelly

yes, I've bumped the problem in groovy only (when programatically creating issues)

mutableIssue = issue;

//here we take list of users from custom field

for (ApplicationUser executor : executors) {
        Object assignee = executor.getName();

        IssueService issueService = ComponentAccessor.getIssueService();
        IssueInputParameters params = issueService.newIssueInputParameters();
        params.setProjectId(mutableIssue.getProjectId());
        params.setIssueTypeId(issueType.getId());
        params.setSummary(mutableIssue.getSummary());
        params.setReporterId(currentUser.name);
        params.setAssigneeId(assignee);
        params.setDescription(mutableIssue.getDescription());


  
        IssueService.CreateValidationResult validationResult = issueService.validateSubTaskCreate(currentUser, mutableIssue.getId(), params);
    
        if (validationResult.isValid()) {
            IssueService.IssueResult createResult = issueService.create(currentUser, validationResult);
            if (createResult.isValid()) {
                MutableIssue newSubtask = createResult.getIssue();

                ComponentAccessor.getSubTaskManager().createSubTaskIssueLink(mutableIssue, newSubtask, currentUser);
            } else {
                println("Creating sub-task failed. Parent issue: " + mutableIssue.getKey());
    
            }
        } else {
            println("Validation creating sub-task failed. Parent issue: " + mutableIssue.getKey());
        }
}

Cannot see an issue there... Is the configuration of both mysql instances the same, eg storage engine? Any other differences between the two jira instances? Is the failing one a test instance, in which case you could try a different DBMS to isolate the problem?

This widget could not be displayed.

as I know for the moment it's due to the trigger on jiraissue table that setup pkey field value:

delimiter |
CREATE TRIGGER `create_issue_set_pkey` BEFORE INSERT ON jiraissue

FOR EACH ROW
BEGIN

set NEW.pkey = CONCAT(
  (select max(project.pkey) from project where project.id = NEW.project),
  '-',
  NEW.issuenum);
END

 

seems it somehow locks update of counter in project table while creation of 2 ок more issues in grrovy

trigger... is this something you added? I'm not that familiar with mysql, is it what is used instead of sequences in other systems?

yes, it's added to remain filling on pkey field https://answers.atlassian.com/questions/222348/jira-6.1-the-issue-keys-have-disappeared-in-the-database actually this trigger works while insert into jiraissue table and it generates pkey value

I'm not sure I understand... so it's a trigger you added? If so, does the subtask creation work if you disable/remove that trigger?

yes, I added this trigger. And subtasks are created if I drop trigger.

So, seems I have to decide to does trigger impact.

Thanks for your help.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

173 views 1 3
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