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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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()); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it the same DBMS in both cases?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.