-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Avoid memory leaks cache attribute, profiler listener #60934
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
[HttpKernel] Avoid memory leaks cache attribute, profiler listener #60934
Conversation
a3367a0
to
5996644
Compare
CI failure is unrelated
|
Introducing an new method means this is a new feature, it should target 7.4 |
5996644
to
2e51bdc
Compare
2e51bdc
to
a7c7c72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me but did you actually experience this leak?
@@ -129,8 +130,7 @@ public function onKernelTerminate(TerminateEvent $event): void | |||
$this->profiler->saveProfile($this->profiles[$request]); | |||
} | |||
|
|||
$this->profiles = new \SplObjectStorage(); | |||
$this->parents = new \SplObjectStorage(); | |||
$this->reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this call then, since reset is going to be called anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just trying to preserve the old logic.
I'll drop it if it's not necessary then
I have a Swoole+Symfony application with memory leak and while investigating the reasons (the memory profiler didn't help with the root cause) I found a possible memory leak in 3rd party library that relies on "kernel.response" event for cleanup (instead of tagging with kernel.reset) and this event is not called in all situations. This prompted me to look for similar potential issues in Symfony so I created this PR to prevent similar issues in the future |
For the current moment, if the
onKernelTerminate
/onKernelResponse
methods won't be called, the listener's state won't be reset between requests.Please let me know if this should be considered as a new feature - to retarget PR to the 7.3 branchSimilar to PR #60933