I am calling an IBM Cloud Function (FaaS) from my Scriptrunner Listener (on Issue Commented Event). Unfortunately the cloud function does not send a response (since it is capsuled in a docker container). As a result the listener crashes and the whole JIRA server instance goes down, due to blocked threads I assume.
BUT: When I call the same IBM Cloud Function from the Scriptrunner Script Console the function is triggered, works smooth and JIRA does not complain.
I assume this is because the Console works on Fire-and-Forget and the Listener does not.
Therefore my question: Can I code the listener or the specific http function call in a Fire-and-Forget manner?
Thank you for your help!
Regarding your question, I would foresee the same issue will happen in Script Console if the IBM Cloud Function didn't respond and the Script Console would keep running as it is. The difference is that Script Console runs on the main thread while Listener often runs on another thread.
Having said that, I would suggest adding some timeout to your HTTP function call instead. That should suffice to tackle the scenario where your function didn't respond and the thread will self-terminate after a time period.
thanks for your input!
Unfortunately I can say with certainty that the function call works fine from the Script Console :O
I think the thread issue goes into the right direction. Even though I do not know how to handle it. Would it be an idea to call the cloud function from an async thread?
I will try to play around with the HTTP function timeout and see if it works.
I can see the following entry in the atlassian-jira.log several times right before the instance goes down:
2021-01-25 11:15:53,819+0000 FelixShutdown ERROR [o.e.g.b.e.i.util.concurrent.RunnableTimedExecution] Closing runnable for context NonValidatingOsgiBundleXmlApplicationContext(bundle=com.onresolve.jira.groovy.groovyrunner, config=osgibundle:/META-INF/spring/*.xml) did not finish in 500ms; consider taking a snapshot and then shutdown the VM in case the thread still hangs
Does this add any information to our brainstorming which is helpful do understand why the whole instance crashes?
Yes, the async thread will definitely help so that it doesn't crash your Jira main thread. However, if the async thread gets stuck too, it will still crash your server.
The error you shared is indicating that the thread is indeed stuck/hangs. You can try using Groovy's AsyncHTTPBuilder, it should allow you to set timeout to an HTTP request.
I hope the above helps!
Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events