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

[Mailer] Fix Sendmail memory leak#59256

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
nicolas-grekas merged 1 commit intosymfony:6.4fromrch7:fix_50486
Jan 7, 2025
Merged

Conversation

rch7
Copy link
Contributor

@rch7rch7 commentedDec 18, 2024
edited by welcoMattic
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#50486
LicenseMIT

Previous PR:#59239

Fixes issue#50486 (Sendmail transport runs out of memory).

  • I have removed unrelated changes that somehow got in the previous attempt of pull request because of wrong base version.
  • As for the "metrics about the memory leak itself" - it is in the issue 50486. When write(), which is defined in vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php, is called without $debug parameter, it's true by default, and $this->debug gets appended all the email body data incrementally.
    So for example if you have loop sending personalized emails to 200,000 subscribers 20 kB each, $this->debug becomes 4 GB, plus overhead, and the script runs out of resources.
    The fix eliminates the problem.

@alexislefebvre

This comment has been minimized.

@welcoMatticwelcoMattic changed the titlefix_50486 - memory leak[Mailer] Fix Sendmail memory leakDec 19, 2024
@@ -114,7 +114,7 @@ protected function doSend(SentMessage $message): void
$this->stream->setCommand($command);
$this->stream->initialize();
foreach ($chunks as $chunk) {
$this->stream->write($chunk);
$this->stream->write($chunk, false);
Copy link
Member

@nicolas-grekasnicolas-grekasJan 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

For next reviewers: this sets the debug flag, so that the stream instance doesn't keep a string copy of what was written.This debug info is not accessible anywhere anyway.
That's similar to:
https://github.com/rch7/symfony/blob/c74e2a3d7e1df817b2bea7d8f6a8fc3373c445bb/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php#L222

@nicolas-grekas
Copy link
Member

Thank you@rch7.

@nicolas-grekasnicolas-grekas merged commit8d5be07 intosymfony:6.4Jan 7, 2025
10 of 11 checks passed
This was referencedJan 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

5 participants
@rch7@alexislefebvre@nicolas-grekas@GromNaN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp