Printing eats up the disk quota when outputFormat = PNG

Description

I have been trying to print maps in PNG format with Geoservers's printing extension. I was doing this to integrate mapfish to wkhtmltopdf so that I can get more freedom in designing printing templates.

After multiple attempts of printing, it gets unable to print out due to a "java.io.IOException: No space left on device" error (verbose error log attached at the end).

This seems to happen because when raster format is chosen geoserver creates an intermediate file named pdfToImage*******tiff (******* are random numbers) in tomcat's cache directory on each request and never removes it. The cache dir is /var/cache/tomcat7/temp in my environment.
The files persistently remain after stopping and restarting geoserver and so they eats up the disc space very quickly (each file is around 7MiB for an A4 page in 180dpi). After deleting these files, it comes back on track until the discspace runs out next time.

It would be nice if the intermediate file is removed after the rendering is done.
Or, if they are necessary to handle download requests following asynchronous print jobs (ie pdf/create.json), is there a way to configure their lifetimes so that the are automatically purged after certain minutes?

Error log:

Environment

Amazon Linux (Linux version 4.1.17-22.30.amzn1.x86_64 (mockbuild@gobi-build-60009))
Oracle JRE 1.8.0 Update 92
Tomcat 7.0.68
Apache pdfbox 1.8.12 and fontbox 1.8.12 are installed to WEB-INF/lib

Assignee

Unassigned

Reporter

Go Sato

Triage

None

Fix versions

None

Affects versions

Components

Priority

Medium