Details
Description
Our application is processing JBIG2 encoded PDFs and is not restarted on a regular basis. When calling pdPage.convertToImage() a temporary file is created and never closed. After some time, the limit (1024 in our case) for open file handles is being hit and we cannot process any more documents. I debugged the code and found the culprit to be pdfbox/filter/JBIG2Filter.java. It is calling ImageIO.createImageInputStream() to create a new ImageInputStream for the ImageReader, but this stream is never being closed. A temporary file is being created (/tmp/imageio<randomNumber>.tmp) as part of this call and remains open if the stream isn't closed.