symfony: Memory Leak in Symfony Mailer when sending many attachments of >5MB
Symfony version(s) affected
5.4.22
Description
Hi ,
I have encountered an issue where attaching several files each of size 5MB , sends Out Of Memory exception
Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\OutOfMemoryError: "Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 23079128 bytes)" at vendor/symfony/mime/RawMessage.php line 53 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\OutOfMemoryError(code: 0): Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 23079128 bytes) at vendor/symfony/mime/RawMessage.php:53)"} [
Is that a known issue. or am I missing something ?
I have already tried using attachPart, attach , but it produces the same results.
How to reproduce
Attach numerous Files from form to be sent in email each of size 5MB .
Possible Solution
No response
Additional Context
No response
About this issue
- Original URL
- State: open
- Created 9 months ago
- Comments: 16 (7 by maintainers)
Commits related to this issue
- feature #51926 [Mime] Forbid messages that are generators to be used more than once (fabpot) This PR was merged into the 6.4 branch. Discussion ---------- [Mime] Forbid messages that are generators... — committed to symfony/symfony by fabpot 9 months ago
- bug #51874 [Mime] Fix memory leak (fabpot) This PR was merged into the 6.4 branch. Discussion ---------- [Mime] Fix memory leak | Q | A | ------------- | --- | Branch? | 6.4 | Bu... — committed to xabbuh/symfony by fabpot 9 months ago
While trying to understand why I wrote the code, I realized we should never change the internal representation. So, #51872 looks like a slightly better fix.