Hi all,
I am writing a plugin archiving jira issue to another service.
The transfer format of issue is json.
When I test on a collection of issues with the total number of issues is about 41000+, it always throw Out of memory exception after certain number of issues transfered.
The out of memory exception is throwed on line:
com.atlassian.jira.util.json.JSONObject.toString(JSONObject.java:1260)
Any people encounter this? Using atlassian.jira.util.JSONObject getting out of memory exception?
Please help suggest and share thoughs here.
Thanks & Regards,
Yaoyu
Page your response. That OOM can be thrown if a string is too large (which I suspect is the case). Serialization in JSON does not write directly to the stream (and since you need to keep it until you write it, you need memory), you either need to serialize pages of data or use json streaming.
Plus, there are some gotchas in the Jackson implementation ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, So do you know how to reuse the com.atlassian.util.JSONObject? I think for each issue, I will new some this class instances. Then it will consume the memory.
And I use HTTPURLConnection object to transfer the json.
I find I forget disconnect every time after I transfer the json.
Will this HTTPURLConnection object consume the memory?
Thanks,
Yaoyu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have used MAT before, but anyone that works with your development environment will do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is hard to say which coding changes will work or not, but using a memory leak dectector will point you in the right direction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Norman,
Thanks. Please see my answer below.
How much memory is allocated for Jira?
>>2G.
How big does your json object get?
>> combine jira rest json and svn plugin json string.
Are you trying to send multiple issues in a single json request?
>> no, one issue one json then send and handle another issue.
Can you use one of Java's memory leak detection tools?
>> could you please help recommend any one?
And,
I am thinking maybe every time I process issue I will new a com.atlassian.jira.util.JSONObject cause this.
I try to reuse the JsonObject. but I failed to find mehtod on this object to reuse it.
Do you think set the reference as null will help?
Or another thought from mine is after processing every 1000 issues I put thread sleep for couple of seconds, will this help?
Thanks & Regards,
Yaoyu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A few thoughts
How much memory is allocated for Jira?
How big does your json object get? Are you trying to send multiple issues in a single json request?
Can you use one of Java's memory leak detection tools?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.