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

Appearance settings

Commit 8d5be07

Browse filesBrowse files
bug #59256 [Mailer] Fix Sendmail memory leak (rch7)
This PR was merged into the 6.4 branch. Discussion ---------- [Mailer] Fix Sendmail memory leak | Q | A | ------------- | --- | Branch? | 6.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? |no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix #50486 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT 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. <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- c74e2a3 fix_50486 - memory leak
2 parents ee941cf + c74e2a3 commit 8d5be07
Copy full SHA for 8d5be07

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎src/Symfony/Component/Mailer/Transport/SendmailTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/SendmailTransport.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function doSend(SentMessage $message): void
114114
$this->stream->setCommand($command);
115115
$this->stream->initialize();
116116
foreach ($chunks as $chunk) {
117-
$this->stream->write($chunk);
117+
$this->stream->write($chunk, false);
118118
}
119119
$this->stream->flush();
120120
$this->stream->terminate();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.