[#12576] - Leaking temporary font files in webapp environment

Category:
Bug report
Priority:
Normal
Status:
Acknowledged
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

Using java.awt.Font.createFont(inputstream) in net.sf.jasperreports.engine.fonts.SimpleFontFace.loadFont() will leak temporary file,
as java internally copies this stream to temporary file, that it keeps open utill JVM shutdown.
see https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/sun/f... createFont2D call.

This causes an issue in webapp context - temporary files are left behind until application server restarts(tomcat).
But jasper font cache goes away when webapplication is restarted.
That means number of this files grows each time webapp is restarted.

Sollution for jasperreports might be to manage temporary folder on its own, and use createFont(File) call?

I'll also raise a bug against JDK, please at least vote for it :)
So its "internal review ID": 9063646, i'll keep this updated if things change.

v6.11
shpondary's picture
Joined: Sep 25 2019 - 5:36am
Last seen: 2 years 5 months ago

4 Comments:

#1
  • Status:New» Acknowledged
  • Assigned:nobody» teodord
#2
  • Reproducibility:N/A» Always

Attached is a workaround I am about to use. Unfortunately i was unable to use JR extensibility(as it only allows to hook on registry) and have to patch JR classes.

#3
AttachmentSize
Package icon jr-patch.zip7.61 KB
#4
Feedback
randomness