Random errors with clone issue post function

Greg Brailsford March 10, 2015

We use script post function clone issue with links. 

The problem does not seem to be with the data or the current user of the transition.  We have tested it were the same issue and same user will reuse the transition and the cloned issue will work properly. I would put the failure rate at about 10%.  It has not been a serious problem until recently because users are creating issues but they don't have visibility/permissions to confirm if they have been made correctly.   

I assume it has something with to many requests in on database at the same time.  However that is hard to confirm. 

 

Here are some details of what we have in the post function settings:

We don't have any conditions and the additional issue actions are

  • checkLink = {link -> false};
  • checkAttachment = {attachment -> false};
  • issue.summary = 'Implementation | ' + issue.summary

 

This is the error we received:

 

2015-03-04 08:09:50,419 http-bio-8080-exec-11 ERROR chad.casey 489x5675x1 3nqz1q 209.33.217.188,199.21.206.132 /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: IM-627, actionId: 11, file: null
com.atlassian.jira.exception.CreateException: Can't transition workflow instance #195121. Current state is 0, requested state is 1
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:722)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:622)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:735)
    at com.atlassian.jira.issue.IssueManager$createIssueObject$1.call(Unknown Source)
    at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.doScript(AbstractCloneIssue.groovy:96)
    at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.super$2$doScript(CreateSubTask.groovy)
    at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.doScript(CreateSubTask.groovy:120)
Caused by: com.atlassian.jira.workflow.WorkflowException: Can't transition workflow instance #195121. Current state is 0, requested state is 1
    at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:905)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:711)
    ... 6 more
Caused by: com.opensymphony.workflow.InvalidEntryStateException: Can't transition workflow instance #195121. Current state is 0, requested state is 1
    at com.opensymphony.workflow.AbstractWorkflow.changeEntryState(AbstractWorkflow.java:493)
    at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:615)
    at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:879)
    ... 7 more

Any help would be appreciated!

11 answers

0 votes
Michael Bittorf April 9, 2015

We see the following error in the lira log file: 2015-04-10 10:36:33,238 http-bio-8080-exec-702 ERROR mbittorf 636x440475x1 1gc9amo 10.0.5.94,10.0.4.1 /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.jira.admin.CopyProject [atlassian.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event '[com.atlassian.jira.event.workflow.WorkflowSchemeAddedToProjectEvent@7de7f940, SingleParameterMethodListenerInvoker{method=public void com.atlassian.jira.auditing.AuditingEventListener.onWorkflowSchemeAddedToProjectEvent(com.atlassian.jira.event.workflow.WorkflowSchemeAddedToProjectEvent), listener=com.atlassian.jira.auditing.AuditingEventListener@47b5edf4}]' from the invoker 'java.lang.RuntimeException: java.lang.NullPointerException' 2015-04-10 10:36:38,397 http-bio-8080-exec-702 ERROR mbittorf 636x440475x1 1gc9amo 10.0.5.94,10.0.4.1 /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.jira.admin.CopyProject [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Can't transition workflow instance #69598. Current state is 0, requested state is 1 com.atlassian.jira.exception.CreateException: Can't transition workflow instance #69598. Current state is 0, requested state is 1 at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:722) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:622) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:735) at com.atlassian.jira.issue.IssueManager$createIssueObject$1.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.doScript(AbstractCloneIssue.groovy:96) at com.onresolve.scriptrunner.canned.jira.utils.CopyIssueWithAttachments.super$2$doScript(CopyIssueWithAttachments.groovy) at com.onresolve.scriptrunner.canned.jira.utils.CopyIssueWithAttachments.doScript(CopyIssueWithAttachments.groovy:10) at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue.super$3$doScript(CloneIssue.groovy) at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue.doScript(CloneIssue.groovy:85) at com.onresolve.scriptrunner.canned.CannedScript$doScript$4.call(Unknown Source) at com.onresolve.scriptrunner.canned.jira.admin.CopyProject$_doCopyProject_closure6.doCall(CopyProject.groovy:525) at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.doCopyProject(CopyProject.groovy:508) at com.onresolve.scriptrunner.canned.jira.admin.CopyProject$doCopyProject$0.callCurrent(Unknown Source) at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.doScript(CopyProject.groovy:278) Caused by: com.atlassian.jira.workflow.WorkflowException: Can't transition workflow instance #69598. Current state is 0, requested state is 1 at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:905) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:711) ... 13 more Caused by: com.opensymphony.workflow.InvalidEntryStateException: Can't transition workflow instance #69598. Current state is 0, requested state is 1 at com.opensymphony.workflow.AbstractWorkflow.changeEntryState(AbstractWorkflow.java:493) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1459) at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:615) at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:879) ... 14 more and mostly of the time the first missing cloned issue is one with links to other issues but not on every failure. It looks similar to me.

0 votes
JamieA
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.
April 8, 2015

Is it definitely similar?

0 votes
Greg Brailsford April 7, 2015

Turns out this is a problem using both bob swift and scriptrunner.  Others have tracked the issue back it actually being a JIRA issue. You can follow the development here https://jira.atlassian.com/browse/JRA-40942.  I posed my fix there.  Basically I added a post function to break leaks and another post function to add links.  I understand this is an error with how JIRA is doing indexing link caches.

JamieA
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.
April 7, 2015

Thanks for pointing to that issue, that could explain quite a lot.

0 votes
Michael Bittorf April 7, 2015

Any progress ? We have a similar issue with "Copy Project" of the Script Runner

0 votes
Greg Brailsford March 25, 2015

It will make all 10 subtasks 90% of the time. Every once in a while I will make the transition and 1 sometime 2 subtasks will fail during creation. The odd thing is if I move the same issue with the same information to the beginning of the workflow and try just moments later the same issue will create all ten. Is it possible that script runner is failing because we have requests happening at the same time at other places on the database? Ill try and get two users to create subtasks at the same and see if that increases the rate of error. Ill ask IT about setting up a test environment.

0 votes
JamieA
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.
March 25, 2015

You're going to need to do something that narrows down the problem. Can you reproduce it in test env? Of the ten how many are created successfully? If you make it 5 sub-tasks does it work?

0 votes
Greg Brailsford March 25, 2015

Script runner Version: 3.0.10 Jira Version 6.3.15 Am I posting this in the wrong place?

0 votes
Greg Brailsford March 23, 2015

We are also experiencing a similar error on create sub task post function. 

We only have the following two lines in "Additional issue actions"

issue.summary = 'P3 account creation ' + issue.summary
issue.description = '{color:#FF6600}*_P3 Account Creation_*{color} Update Jira with primary username password.'

 

This post function happens in the middle of the workflow.  We do however have 10 sub tasks that are getting created during this transition. 

0 votes
Greg Brailsford March 18, 2015

Still having the issue any ideas?

0 votes
Greg Brailsford March 11, 2015

Yes, On this specific one the following happens on Create: The following will be processed after the transition occurs Assign the issue to the current user. Please note that the issue will only be assigned to the current user if the current user has the 'Assignable User' permission. he Field Reporter will take the value from Assignee . Value of field Assignee will be added to field TCN Watchers: . Creates the issue originally. Re-index an issue to keep indexes in sync with the database. Fire a Issue Created event that can be processed by the listeners. Script workflow function : Fast-track transition an issue : If the condition is met the action 101 auto advance IM will be applied. Note that this should go after the Fire Event function. Ill also add what happens on the next transition since we do fast track. If user is a member of the Users role, set issue security level to TCN Watchers (TCN Linking Permissions). Current issue will be linked using issue link Client implementation projects to every issue returned by the following JQL query: issueFunction in linkedIssuesOf("project = PD AND ClientEmail ~ '%{ClientEmail}'", "Employee of") Current issue will be linked using issue link Client implementation projects to every issue returned by the following JQL query: issueFunction in linkedIssuesOf("project = LPD AND ClientEmail ~ '%{ClientEmail}'", "Employee of") Set issue status to the linked status of the destination workflow step. Add a comment to an issue if one is entered during a transition. Update change history for an issue and store the issue in the database. Re-index an issue to keep indexes in sync with the database. Fire a Generic Event event that can be processed by the listeners. I should also add some times the issue will be created properly but the linking that takes place in the second step fails. The end result is about the same the current user thinks it failed to create because the links did not appear. As I write this I see a that jql could be combined the the issue created event should probably be moved up the list.

0 votes
JamieA
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.
March 10, 2015

On the workflow of the issues that you are creating via "clone and link", do you have any particular post-functions on the Create step?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events