Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chromium memory leaks #705

Merged
merged 1 commit into from
Oct 23, 2023
Merged

fix: chromium memory leaks #705

merged 1 commit into from
Oct 23, 2023

Conversation

gulien
Copy link
Collaborator

@gulien gulien commented Oct 22, 2023

Close #642.

⚠️ A single Chromium browser is now started, and it now works as the same manner as LibreOffice "stateful", i.e.:

  • No concurrent conversions.
  • If browser is not healthy, it is restarted before a conversion.

Flags

New:

  • --chromium-restart-after - Number of conversions after which Chromium will automatically restart. Set to 0 to disable this feature (default 0).
  • --chromium-auto-start - Automatically launch Chromium upon initialization if set to true; otherwise, Chromium will start at the time of the first conversion (default false).
  • --chromium-start-timeout - Maximum duration to wait for Chromium to start or restart (default 10s).

Deprecated flag: chromium-failed-starts-threshold

Metrics

New:

  • chromium_requests_queue_size - Current number of Chromium conversion requests waiting to be treated.
  • chromium_restarts_count - Current number of Chromium restarts.

Deprecated:

  • chromium_active_instances_count
  • chromium_failed_starts_count

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2023

Codecov Report

Merging #705 (416e40b) into main (258876d) will increase coverage by 0.17%.
The diff coverage is 96.09%.

❗ Current head 416e40b differs from pull request most recent head 41cd16e. Consider uploading reports for the commit 41cd16e to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main     #705      +/-   ##
==========================================
+ Coverage   93.24%   93.42%   +0.17%     
==========================================
  Files          36       40       +4     
  Lines        3138     3268     +130     
==========================================
+ Hits         2926     3053     +127     
- Misses        135      137       +2     
- Partials       77       78       +1     
Files Coverage Δ
pkg/gotenberg/flags.go 100.00% <100.00%> (ø)
pkg/gotenberg/mocks.go 100.00% <100.00%> (ø)
pkg/gotenberg/supervisor.go 100.00% <100.00%> (ø)
pkg/modules/api/mocks.go 100.00% <100.00%> (ø)
pkg/modules/chromium/debug.go 100.00% <100.00%> (ø)
pkg/modules/chromium/mocks.go 100.00% <100.00%> (ø)
pkg/modules/chromium/routes.go 98.40% <100.00%> (-1.60%) ⬇️
pkg/modules/logging/logging.go 90.21% <100.00%> (ø)
pkg/modules/pdfcpu/pdfcpu.go 100.00% <100.00%> (ø)
pkg/modules/chromium/chromium.go 97.33% <97.18%> (+5.33%) ⬆️
... and 2 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@gulien
Copy link
Collaborator Author

gulien commented Oct 22, 2023

@petternordlanderhelo @JulienWeintraub

Image gulnap/gotenberg:chromium-memory-leaks-fix is available for your tests.

It will not solve the memory leaks on Chromium side, but at least it’s mitigated in Gotenberg. Also, faster unitary conversion.

@gulien gulien added the enhancement New feature or request label Oct 22, 2023
@gulien gulien force-pushed the fix/chromium-memory-leaks branch 2 times, most recently from 4924d95 to 6a1c430 Compare October 23, 2023 15:10
@gulien
Copy link
Collaborator Author

gulien commented Oct 23, 2023

This version is currently running (smoothly) on the demo instance. I'm going to merge this PR, but feel free to keep me informed if you notice anything 😉

@gulien gulien merged commit 54daac3 into main Oct 23, 2023
2 checks passed
@gulien gulien deleted the fix/chromium-memory-leaks branch October 23, 2023 15:52
@gulien gulien mentioned this pull request Oct 30, 2023
14 tasks
@JulienWeintraub
Copy link

This version is currently running (smoothly) on the demo instance. I'm going to merge this PR, but feel free to keep me informed if you notice anything 😉

Thanks @gulien for the job !
I'll test it as soon as I have a moment

@gulien
Copy link
Collaborator Author

gulien commented Oct 30, 2023

Thanks @JulienWeintraub! There is also now a gotenberg/gotenberg:edge version for testing purpose 👍
FYI, the memory is still growing, but less than before AFAIK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak Chrome
3 participants