Skip to content

fix(symfony): reset the skolem IRI converter between requests - #8681

Open
silverbackdan wants to merge 1 commit into
api-platform:4.4from
silverbackdan:fix/skolem-iri-converter-kernel-reset
Open

silverbackdan wants to merge 1 commit into
api-platform:4.4from
silverbackdan:fix/skolem-iri-converter-kernel-reset

Conversation

@silverbackdan

@silverbackdan silverbackdan commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.4
Tickets -
License MIT
Doc PR -

Fix: #8680

I hit memory growth running API Platform under FrankenPHP worker mode and tracked it down to this.

SkolemIriConverter already implements ResetInterface, but its service (api_platform.symfony.iri_converter.skolem) isn't tagged kernel.reset, so services_resetter never calls reset() between requests. Its object → IRI map then keeps every object that got a /.well-known/genid/... IRI alive for the life of the worker.

In one of our projects, an endpoint that returns a lot of embedded non-resource objects took a single worker to our 128M memory_limit in about five requests. In our other apps it grows much more slowly (on our own metadata objects), which is probably why it hadn't shown up before.

To reproduce: boot one kernel, handle the same request a few times, and call services_resetter->reset() between them, as a worker does. With a response that embeds non-resource objects, the skolem map grows by the number of embedded objects on every request. With the tag, it's cleared each time and memory stays flat.

The fix is the missing tag, plus an assertion in the extension test.

SkolemIriConverter implements ResetInterface but its service was not tagged
kernel.reset, so in long-running workers (FrankenPHP worker mode) its object
map kept every object that received a genid IRI alive for the life of the
worker.
@silverbackdan

silverbackdan commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Would you want any tests in here to harden it besides the simple assertion? Maybe it's worth thinking about having tests to make sure services extending ResetInterface have autoconfig on or are tagged so they do not get missed?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant