Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporary font files are not always be purged in multi threaded server environments like wildfly #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markus-graf
Copy link

@markus-graf markus-graf commented Mar 14, 2023

Thousands of thousands of temporary font files can be remain in temp folder on a long running application when multiple threads using JasperReports.
See also https://community.jaspersoft.com/jasperreports-library/issues/13526

@mnboubtane
Copy link

mnboubtane commented Mar 28, 2023

hello ,
In wich version it's available ? i faced the same issue and i'm in 6.20
you merged it soon ?
Thanks

@Phillipus
Copy link

This is happening on Windows using JR library 6.21.4 (but not Mac or Linux).

When a report is created, several temporary font files are created in the temp folder like jr-font166714330084035962.ttf. Some are deleted when the Java process finishes, but not all. After some time there are thousands of these files.

Phillipus added a commit to archimatetool/archi that referenced this pull request Jan 10, 2025
- Unfortunately, we can't use the latest version (currently 6.21.4) because version 6.13 and later doesn't delete the "jr-fontXXXXXXXXXXXXXX.ttf" temporary font files in the temp folder on exit on Windows. See Jaspersoft/jasperreports#337

- If we ever do use a later version we should only need to update jasperreports-x.x.x.jar and jasperreports-fonts-x.x.x.jar

- Note that we now use openpdf-x.x.x.jar rather than itext-x.x.x.jar
@teodord
Copy link
Collaborator

teodord commented Jan 10, 2025

You mention files remaining after Java process finishes. How exactly is the process finishing? Does it get killed? Does the JVM crash? Or does it finish properly?

@Phillipus
Copy link

You mention files remaining after Java process finishes. How exactly is the process finishing? Does it get killed? Does the JVM crash? Or does it finish properly?

It finishes properly. This is reproducible in unit tests and in our application.

What happens is that font files that are created in AwtFontManager are marked to be deleted on exit:

https://github.com/TIBCOSoftware/jasperreports/blob/4df899783f6198a3e7479948356a8a7b75294603/core/src/main/java/net/sf/jasperreports/engine/fonts/AwtFontManager.java#L79-L80

However, when Java calls its method to delete files on exit, these ones are locked by JR and cannot be deleted.

This is only on Windows (11) not Mac or Linux.

@teodord
Copy link
Collaborator

teodord commented Jan 11, 2025

It finishes properly. This is reproducible in unit tests and in our application.

You mean the unit tests you have in your own application project?
Or the tests that come with our JasperReports project?

If you have a test case that consistently reproduces the issue, it would help a lot.

@Phillipus
Copy link

Phillipus commented Jan 11, 2025

It finishes properly. This is reproducible in unit tests and in our application.

You mean the unit tests you have in your own application project? Or the tests that come with our JasperReports project?>

I mean our unit tests.

If you have a test case that consistently reproduces the issue, it would help a lot.

Do you have any advice on how to create a test case? Our app is Eclipse based and uses the JR library and other libs to create reports from jrxml files so it's not easy to extrapolate a simple stand-alone test.

@Phillipus
Copy link

If you have a test case that consistently reproduces the issue, it would help a lot.

@teodord I opened #505 with a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants