Skip to content

[Serializer] Rewrite AbstractObjectNormalizer::createChildContext() to use the provided cache_key from original context when creating child contexts #53530

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

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

amne
Copy link
Contributor

@amne amne commented Jan 12, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues N/A
License MIT

If the normalization starts with an initial 'cache_key' it is currently discarded when creating child contexts. This change fixes that.
The main reason behind it is that if the client code sends a unique identifier (ApiPlatform injects the IRI) and we have a use case
that iterates a big resultset we end up with a big private cache that quickly runs out of allowed memory. The solution should be to
send a 'cache_key' which skips the entire cache key calculation that hashes the context.

@mtarld
Copy link
Contributor

mtarld commented Jan 13, 2024

Follow-up of #53523

@amne amne changed the title [Serializer] Rewrite AbstractObjectNormalizer::createChildContext() to use the provided cache_key from original context when creating child contexts [Serializer] Rewrite AbstractObjectNormalizer::createChildContext() to use the provided cache_key from original context when creating child contexts Jan 13, 2024
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor CS comments

… to use the provided `cache_key` from original context when creating child contexts
@nicolas-grekas
Copy link
Member

Thank you @amne.

@nicolas-grekas nicolas-grekas merged commit af9fa66 into symfony:5.4 Jan 29, 2024
nicolas-grekas added a commit that referenced this pull request Jan 29, 2024
…false (xabbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[Serializer]  do not overwrite the cache key when it is false

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #53530 (comment)
| License       | MIT

Commits
-------

fd00244 do not overwrite the cache key when it is false
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.

4 participants