gotenberg: Memory leaks on large conversions with the LibreOffice module

When I run docker run --rm -p 3000:3000 gotenberg/gotenberg:7 gotenberg --log-level=debug --chromium-disable-routes true --pdfengines-disable-routes true --api-read-timeout 600s --api-process-timeout 30s --api-write-timeout 60s

I get

[SYSTEM] modules: api chromium gc libreoffice logging pdfcpu pdfengines pdftk prometheus unoconv unoconv-pdfengine webhook 
[SYSTEM] gc: application started
[SYSTEM] api: server listening on port 3000
[SYSTEM] prometheus: collecting metrics
{"level":"debug","ts":1641996936.2557855,"logger":"api","msg":"form data values: map[]","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
{"level":"debug","ts":1641996936.2558823,"logger":"api","msg":"form data files: map[Design Process Workshop by Slidesgo.pptx:/tmp/6af267cc-9ad6-43a2-b882-49fb6b59af56/Design Process Workshop by Slidesgo.pptx]","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
{"level":"debug","ts":1641996936.262925,"logger":"api","msg":"print to PDF with: {Landscape:false PageRanges: PDFArchive:false}","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
{"level":"debug","ts":1641996936.2766035,"logger":"api.cmd","msg":"start unix process: /usr/bin/unoconv --user-profile ///tmp/b587b96a-4b33-4de0-8c22-f6c5f45de70f --port 41097 --format pdf --output /tmp/6af267cc-9ad6-43a2-b882-49fb6b59af56/cfd03e94-9069-47ac-9823-2b5b4309b6be.pdf /tmp/6af267cc-9ad6-43a2-b882-49fb6b59af56/Design Process Workshop by Slidesgo.pptx","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
**{"level":"debug","ts":1641996964.961774,"logger":"api.cmd","msg":"unix process killed","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}**
{"level":"debug","ts":1641996965.0490973,"logger":"api","msg":"remove user profile directory '/tmp/b587b96a-4b33-4de0-8c22-f6c5f45de70f'","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
{"level":"debug","ts":1641996965.06678,"logger":"api","msg":"'/tmp/6af267cc-9ad6-43a2-b882-49fb6b59af56' removed","trace":"2797df6d-05fb-408b-b9a6-497111fccba4"}
{"level":"error","ts":1641996965.0874858,"logger":"api","msg":"convert to PDF: unoconv PDF: context done: context deadline exceeded","trace":"2797df6d-05fb-408b-b9a6-497111fccba4","remote_ip":"172.17.0.1","host":"localhost:3000","uri":"/forms/libreoffice/convert","method":"POST","path":"/forms/libreoffice/convert","referer":"","user_agent":"PostmanRuntime/7.28.4","status":503,"latency":30142063400,"latency_human":"30.1420634s","bytes_in":8124389,"bytes_out":19}

This works fine with small-sized files but a file from 5MB and above returns the above error and gives a 503 Service Unavailable error on the client.

@gulien

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22

Most upvoted comments

Hello there @jesseinit ! Quick question: Do you have an estimate on how many conversions it took for this to take place?

image

Thanks!

You could count from the number of spikes.

hi @gulien I’m currently facing some memory leak issues, after gotenberg converts a document, it doesn’t free up memory. image

@jesseinit Do you see any change regarding memory leaks when disabling the listener feature?

I really didn’t see any change, memory was still clogged even after conversion was completed even when using the suggested flag.

I’ll test and revert.

I was able to resolve the issue by increasing the memory limits for docker and all is good.