[#4068] - JRVirtualization Memory leak

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I have a specific memory leak issue in Jasper Report . Can you help me to solve this problem ?

Our Production Scenario

1. We have a separate JVM instance which runs in multi threaded manner
2. Each thread wait a Jasper report request and execute it
3. Our report page size around 2000 page
4. We are using JRVirtualizer with the sub reports
5. Jasper Version used is 1.2.0

Issue Identified

1. When the JVM is restarted and for the first two hrs there is no issue
2. After two hrs time the performance of the report generation is drastically reduced
3. Finally it end up in out of memory or very slow process

Analysis Done so far

1. We had taken the head dump and analyze the memory usage at that point of time
2. The heap analyzer tool indicate the memory leak of 320 MB
3. Memory leak is coming from main object ‘DeleteOnExitHook’
4. It internally holding millions of HashMap object
5. Each of the HashMap object holding the JRVirtualizer temporary file name

I have also attached the screen shot for your reference

AttachmentSize
File jasperissue.rtf12.75 MB
kirubakaran.chandrasekar's picture
Joined: Jan 28 2015 - 12:14am
Last seen: 7 years 6 months ago

14 Comments:

#1
  • Assigned:nobody»

See the net.sf.jasperreports.virtualizer.files.delete.on.exit property. The doc (http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasper...) says that the property has been available since 1.2.3, so it might not work in 1.2.0. That's a very old version anyway, you should consider upgrading.

Regards,
Lucian

#2
  • Assigned:» anonymous

Hi, Here the problem not on the temp file not getting deleted. The temp filed are getting deleted properly from the file system. But it references are still help in the memory the under the object '‘DeletoeOnExitHook’. Please refer the heam dump analyzer attachment.

Order to correct the problem what should be the value set in the net.sf.jasperreports.virtualizer.files.delete.on.exit property

#3

Setting the net.sf.jasperreports.virtualizer.files.delete.on.exit property to false might avoid the DeleteOnExitHook memory accumulation problem.

#4

Hi Lucianc, Thanks for the information. I want to test this condition based upon your suggestion. Can you help me give the latest stable Jasper Version and how to download it for the testing purpose ?

#6

Hi, how do I set this properly to false ? Is it through some property file setting ? Or I need to set this value as false in some object . Please provide more detail on this

#7

The property is usually set in the JR configuration file called jasperreports.properties (which needs to be placed in a directory that's part of the application classpath).

#8

Hi,

The exact property name is
net.sf.jasperreports.virtulazer.temp.files.set.delete.on.exit=false

Am i right ?

#9

No, the correct line is

net.sf.jasperreports.virtualizer.files.delete.on.exit=false

#10

Hi Lucianc, I have set this property as mentioned by you in the version 1.2.3. But still I am getting the same memory leak from DeleteOnExitHook. Please suggest what could have gone wrong here ? Please refer to the attached document for the details ....

Regards,
Kiru

AttachmentSize
File v1.2.3-memoryleak.rtf996.94 KB
#11

Hi Lucianc, I have tried the same with the version 3.0. Still the memory leak is coming from the same class DeleteOnExitHook. Please suggest any other option we can try to resolve this issue ?

Regards,
Kiru

#12

Please include a text field with the following expression in a report and run it in your application:

net.sf.jasperreports.engine.util.JRProperties.getBooleanProperty(net.sf.jasperreports.engine.fill.JRFileVirtualizer.PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT)

The text field should print false if net.sf.jasperreports.virtualizer.files.delete.on.exit=false is properly set.

#13

Hi Lucinac,

When I add the property file in the classpath it is not working. But if i add it as system property with -D option then is working fine ....
Now in the heap dump I don't see any memory leak.
Thanks a lot for your valuable input in solving the issue.

One final question I have is, this problem reported only from beyond certain version JDK ?

Regards,
Kiru

#14

Afaik the File.deleteOnExit() memory problem exists at least from JDK 1.4 (and up to 8).

Feedback