Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mime] Fix memory leak#51874

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.4fromfabpot:mime-message-memory-fix
Oct 10, 2023
Merged

Conversation

@fabpot
Copy link
Member

@fabpotfabpot commentedOct 6, 2023
edited
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#51764
LicenseMIT

@fabpotfabpotforce-pushed themime-message-memory-fix branch from3fa982c toed0d833CompareOctober 6, 2023 16:53
@fabpotfabpot changed the base branch from5.4 to6.4October 6, 2023 16:54
@fabpotfabpotforce-pushed themime-message-memory-fix branch fromed0d833 to606ee03CompareOctober 6, 2023 16:57
@fabpot
Copy link
MemberAuthor

Fixing it is not possible in 5.4.
I propose to deprecate the possibility of sending a message with a closed generator in 6.4 and throw in 7.0. That way, we don't need to store the generator result and that avoids the memory leak.

@stof
Copy link
Member

stof commentedOct 6, 2023

@fabpot the issue is not just about sending a message with a closed generator. If you try to both access the string content and serialize the object, this will make 2 usages of the iterator, with the RawMessage being the one closing the generator in the first usage.

@fabpot
Copy link
MemberAuthor

@stof Sure, but that's not something people will do. What would you suggest?

@chalasr
Copy link
Member

Isn't patching onlytoIterable() enough to fix the issue?

diff --git a/src/Symfony/Component/Mime/RawMessage.php b/src/Symfony/Component/Mime/RawMessage.phpindex d2a311daeb..14223d3d7f 100644--- a/src/Symfony/Component/Mime/RawMessage.php+++ b/src/Symfony/Component/Mime/RawMessage.php@@ -48,12 +48,9 @@ class RawMessage implements \Serializable             return;         }-        $message = '';         foreach ($this->message as $chunk) {-            $message .= $chunk;             yield $chunk;         }-        $this->message = $message;     }      /**

Transforming the generator to an array intoString() seems unavoidable, unless we forbid calling toString() more than once which sounds worse.

@fabpotfabpotforce-pushed themime-message-memory-fix branch from606ee03 toee81ae4CompareOctober 10, 2023 06:07
@fabpotfabpot merged commitd6c8797 intosymfony:6.4Oct 10, 2023
@fabpotfabpot deleted the mime-message-memory-fix branchOctober 10, 2023 06:10
fabpot added a commit that referenced this pull requestOct 15, 2023
…more than once (fabpot)This PR was merged into the 6.4 branch.Discussion----------[Mime] Forbid messages that are generators to be used more than once| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | yes| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets       |Fix#51764,Fix#51874| License       | MITThis is a continuation of#51874, when someone tries to send the same message more than once.`@chalasr` `@stof`Commits-------3c5fe51 [Mime] Forbid messages that are generators to be used more than once
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Memory Leak in Symfony Mailer when sending many attachments of >5MB

3 participants

@fabpot@stof@chalasr

[8]ページ先頭

©2009-2025 Movatter.jp