Prevent infinite nesting of lazy ObjectManager
instances when ObjectManager
is reset
#44399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch ensures that the
ObjectManager
that theSymfony\Bridge\Doctrine\ManagerRegistry
replaces during
Symfony\Bridge\Doctrine\ManagerRegistry#resetService()
operations is a freshnon-lazy service.
Before this change,
Symfony\Bridge\Doctrine\ManagerRegistry#resetService()
would replace theinitialization of the lazy proxy with a new service each time, but that service being lazy, this
led to an additional proxy nesting level at each service reset call. That leads to general
issues around memory reliability, stack trace nesting (and therefore bigger logged traces) and
potentially even stack overflow problems, when running with XDebug.
The problem seems to only apply when the
symfony/dependency-injection
Container
is compiledas a set of small factory files: that's because each generated factory has a boolean flag that
indicates whether a lazy or non-lazy version of a service is requested, as introduced in the
original implementation at #7890