Commit 8d5be07
committed
bug symfony#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 symfony#50486 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License | MIT
Previous PR: symfony#59239
Fixes issue symfony#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 leak1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
0 commit comments