Some told me that you can run commands when JVM runs out of memory but I am not sure if the below command will work or not as I do expect that this will only kill jira service, and not have time to start it again.
This has to go inside bin/setenv.sh file:
JVM_SUPPORT_RECOMMENDED_ARGS="-XX:OnOutOfMemoryError=\"service jira stop;service jira start\""
Please state if this will work and if not please suggest and alternative that works.
This command works just fine
java '-XX:OnOutOfMemoryError=nohup bash -c "service jira stop;service jira stop" &' test
Still, the trick of putting it inside the is more complex than it may seem, check http://stackoverflow.com/questions/11687292/how-to-do-a-proper-double-or-triple-bash-quote-escape
Oracle docs reports it added to Java 1.4.2 Update 12 - http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
Still, there is the trick of killing jira, probably we need to add a nohup command too.
Rather than addressing the symptom of the problem, I'd suggest addressing the root cause of why your JIRA instance is running into OutOfMemoryError's (OOME) in the first place.
Have you tried enabling GC logging or heap dumps on OOME to investigate further? You could do this by adding the following JVM arguments:
Every time JIRA is restarted, the GC log will be overwritten. Please ensure to manually rotate it (copy it to another name) before restarting JIRA.
You could then look at tools like GCViewer and Samurai to review your GC logs and heap dumps, respectively, to see if you can isolate the root cause. Likely problems may be third-party plugins or the box simply doesn't have enough resources for the JVM's requirements.
The questions was not about how to debug jira and was only about keeping it running. This is required by an 3.x jira instance which is not supported by atlassian so debugging it doesn't help at all. We already tried this approach but what I want is a watchdog/keepalive tool.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs