I added a Groovy script in the post-function , it's create an issue and issuelink the current issue.
However, I noticed that when it executes in the actual workflow, the issuelink API times out. Although the request timed out, the issuelink was successful in the end.
And i tested the script separately, and it worked fine. Could you please help me with this issue?
env: jira software version 9.10.1, centos7
access_log find "POST /rest/api/2/issueLink- HTTP/1.1" 500 55 50081 "-" "Java/11.0.13" "t6ydwf"
catalina.2024-02-18.log find :
18-Feb-2024 21:02:28.456 WARNING [Catalina-utility-1] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread [http-nio-8080-exec-3 url: /secure/CommentAssignIssue.jspa; user: sha**] (id=[24]) has been active for [121,529] milliseconds (since [2/18/24 9:00 PM]) to serve the same request for [http://*.link/secure/CommentAssignIssue.jspa?atl_token=***_lin] and may be stuck (configured threshold for this StuckThreadDetectionValve is [120] seconds). There is/are [1] thread(s) in total that are monitored by this Valve and may be stuck.
code about is:
for(user in allWorkers){
log.error(user)
def requestBody = """
{
"fields": {
"issuetype": {"id": "10101" },
"project": {"id": "10100" },
"fixVersions": [{"name": "${fixVersions}"}],
"summary": "${summary}",
"priority": {"name": "${priority}" },
"components": [{"name": "${component}"}],
"assignee": {"name": "${user}" },
"reporter": {"name": "${reporter}" },
"customfield_10216": {"value": "${needTest}" },
"versions": [{"name": "${versions}"}]
}
}
"""
def res = req.sendPostRequest(requestBody, "rest/api/2/issue")
def slurper = new JsonSlurper()
def result = slurper.parseText(res)
log.error(res.toString() )
def targetIssueKey = result.key
result_key.add(targetIssueKey)
}
def req2 = new NewLinkIssue()
for(iKey in result_key){
try{
def linkReqBody = """{"type":{"name":"Relates"},"inwardIssue":{"key":"${sourceIssueKey}"},"outwardIssue":{"key":"${iKey}"},
"comment": {"body": "Linked related issue!"}}"""
log.error("start issueLink")
req2.sendPostRequest(linkReqBody, "rest/api/2/issueLink")
log.error("inwardIssue success")
} catch(Exception e){
log.error("inwardIssue failed")
}
}