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

Avoid very long log lines and resulting OOM #1073

Merged

Conversation

rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Oct 14, 2024

Purpose

Sometimes data like a vCard with a big (16 MB) photo causes very long log lines (as in: 40 MB string), which may cause out-of-memory conditions.

Depends on bitfireAT/vcard4android#46

Short description

This PR tries to avoid long log lines on two layers:

  1. The original cause in vcard4android. Contact.toString: truncate note, photo, unknown properties vcard4android#46 reduces Contact.toString() size if there are big photos or long notes or unknown properties.
  2. PlainTextFormatter now has some truncation logic to avoid far too long log lines.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@rfc2822 rfc2822 added the bug Something isn't working label Oct 14, 2024
@rfc2822 rfc2822 self-assigned this Oct 14, 2024
@rfc2822 rfc2822 linked an issue Oct 14, 2024 that may be closed by this pull request
@rfc2822 rfc2822 force-pushed the 1072-oom-while-processing-big-16-mb-vcard-with-photo branch from 6b57f41 to fc1abea Compare October 15, 2024 09:28
Copy link

@rfc2822 rfc2822 marked this pull request as ready for review October 15, 2024 11:28
@rfc2822 rfc2822 requested a review from sunkup October 15, 2024 11:28
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No test? Works fine though 👍

@rfc2822
Copy link
Member Author

rfc2822 commented Oct 15, 2024

No test?

You're right ^^

@rfc2822
Copy link
Member Author

rfc2822 commented Oct 15, 2024

Added test.

@rfc2822 rfc2822 merged commit 62c46e1 into main-ose Oct 15, 2024
7 checks passed
@rfc2822 rfc2822 deleted the 1072-oom-while-processing-big-16-mb-vcard-with-photo branch October 15, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OOM while processing big (~ 16 MB) vCard with photo
2 participants