carbone
carbone copied to clipboard
Workaround for LibreOffice memory leak not working properly [Bug Report]:
Issue reproduced on two environments
Environment1 Carbone Version: 3.00 Node Version: 14.16.0 LibreOffice Version: 7.0.4.2 RAM: 16GB
Environment2 Carbone Version: 2.0.2 Node Version: 10.16.0 LibreOffice: 6.1.6.3 RAM: 4GB
In our scenario, there is a long running process performing thousands of PDF generations in a row (with the rate of 3 documents for minute). For no evident reason, carbone stops working after the generation of (more or less) 1500 documents.
We did not find any mention of the issue in the online documentation, neither a reported issue. After inspecting carbone code we found the implementation of the workaround for the well-known memory leak affecting latest versions of LibreOffice: it seems that default values for parameters "factoryMemoryFileSize" and "factoryMemoryThreshold" (both located in file params.js) are not effective in our environments so we had to manually edit the values.
Considering that future updates of carbone package will overwrite our changes, it would be nice if the aforementioned parameters could be optionally provided by the consumer of the carbone library, falling back on values stored in file params.js for default only.
Hello @edgrasso, sorry for the delay.
You can already change default values with the set function:
const carbone = require('carbone')
carbone.set({ factoryMemoryFileSize: 2, factoryMemoryThreshold: 25 })
Let me know if it working on your side.