Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@andrew-demb
Copy link
Contributor

@andrew-demb andrew-demb commented May 22, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #50580
License MIT

Register mailer.message_logger_listener only when profiler enabled to prevent memory leaks as suggested in:

@stof can you guide me about the way how to implement your second suggestion too? #50580 (comment) UPD: resolved

This change may be considered as a minor BC break - DI service won't be available anymore with disabled profiler.

@carsonbot carsonbot added this to the 7.3 milestone May 22, 2025
@carsonbot carsonbot changed the title 📦 [#50580] Memory leak with mailer.message_logger_listener [Mailer] 📦 [#50580] Memory leak with mailer.message_logger_listener May 22, 2025
@OskarStark OskarStark changed the title [Mailer] 📦 [#50580] Memory leak with mailer.message_logger_listener [Mailer] Fix memory leak with mailer.message_logger_listener May 22, 2025
@andrew-demb
Copy link
Contributor Author

CI failure is unrelated

1) Symfony\Component\HttpClient\Tests\AmpHttpClientTest::testNonBlockingStream
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'<1>'
+''

/home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php:128

@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
@94noni
Copy link
Contributor

94noni commented Sep 10, 2025

For the référence comment with #60243
I think you need to update the messenger data collector and traceables sub logic
You can check how it was done for others in the PR
The goal is to stop collecting data if the profiler is disabled on runtime

@fabpot
Copy link
Member

fabpot commented Sep 16, 2025

@andrew-demb Are you still interested in working on this PR?

@andrew-demb
Copy link
Contributor Author

@fabpot yeah, sure. Thanks for the ping.
@94noni, now it seems that I got it. Thanks for the help.

PR updated.
I'm not sure whether it should be considered a feature or a bug fix. For now, I left this as a new feature (target 7.4). Refs: #60515 (comment)

@94noni
Copy link
Contributor

94noni commented Sep 16, 2025

nice 👍🏻
as #60243 was merged as bugfix (and paving the foundation of those dev data collect stuff to be ignored), perhaps this one can be also

@andrew-demb andrew-demb changed the base branch from 7.4 to 7.3 September 16, 2025 11:15
@andrew-demb
Copy link
Contributor Author

Reclassified these changes to bugfix - changed target branch, updated PR description, dropped entry from the changelog.

@nicolas-grekas nicolas-grekas modified the milestones: 7.4, 7.3 Sep 16, 2025
@fabpot
Copy link
Member

fabpot commented Sep 17, 2025

Thank you @andrew-demb.

@fabpot fabpot merged commit f4d0610 into symfony:7.3 Sep 17, 2025
9 of 11 checks passed
@andrew-demb andrew-demb deleted the 50580-memory-leak branch September 17, 2025 05:52
@fabpot fabpot mentioned this pull request Sep 27, 2025
@kochen
Copy link
Contributor

kochen commented Sep 29, 2025

This seems to make the wrong assumption that the LoggerListener is used only by the profiler, breaking (at least) Mailer Assertions - see: #61873 (comment)

@BacLuc
Copy link

BacLuc commented Oct 26, 2025

Because of this change
the assertEmailCount assertion did not work anymore.
The profiler was disabled in the second request.

We had to make the following change:
https://github.com/ecamp/ecamp3/pull/8228/files#diff-bec0448f23ef04c115375d2515e2c230d351a01156bfa534b24990369b6356e9

@xabbuh
Copy link
Member

xabbuh commented Oct 26, 2025

@BacLuc see #61924 where we reverted this change, it will be part of the next patch release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mailer] Memory leaking when sending many emails

9 participants