Issue
- Application nodes frequently crash.
- The following error appears in the logs:
ERROR [liferay/document_library_pdf_processor-1][PDFProcessorImpl:795] java.util.concurrent.ExecutionException: com.liferay.petra.process.ProcessException: java.lang.OutOfMemoryError:Java heap space
java.util.concurrent.ExecutionException: com.liferay.petra.process.ProcessException: java.lang.OutOfMemoryError: Java heap space
Environment
- Liferay DXP 7.1
Resolution
- The issue is caused by the system running out of memory while trying to generate preview images from PDF documents, specifically when using PDFBox and occurring the above mentioned error.
- To resolve this, add the following property to the
portal-ext.propertiesfile: -
# Set the interval in seconds before document previews generation times out
# and it is cancelled when processed by PDFBox. This property applies only
# when the property "dl.file.entry.preview.fork.process.enabled" is set to
# true.
dl.file.entry.preview.generation.timeout.pdfbox=1200 - The property specifies the maximum duration the portal will wait for the PDF processor to complete its conversion.
- By default, this is set to 1200 seconds (20 minutes) in Liferay. You can adjust this value as needed. If the PDFBox process exceeds the configured time limit, process will be terminated, preventing the `OutOfMemoryError`.
Additional Information
- The ImageMagick or GhostScript connectors can be used as alternatives to PDFBox for generating document previews.
- Configuring External Services