Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner Listener - Fire-and-Forget Edited

Hi Community!

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!

 

Cheers

Niklas

1 answer

Hi Niklas, 

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. 

Hi Benz,

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?

 

Thank you!

 

Cheers

 

Niklas

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! 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,073 views 8 28
Join discussion

Community Events

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

Events near you