Problem/Motivation
With persistent app servers such as FrankenPHP worker mode, Symfony's default MIME registry stays alive and handles multiple requests. MimeTypeGuesser::registerWithSymfonyGuesser() registers Drupal's guesser directly, retaining it and its dependencies even after the container is discarded. Container references reachable through those dependencies prevent garbage collection until the registry is replaced.
Steps to reproduce
- Create a container with a file.mime_type.guesser test double that holds a reference to that container.
- Register it using the helper above and create a weak reference to the container.
- Unset local container and guesser references, then call
gc_collect_cycles(). - The weak reference still returns the container; it should return
NULL.
Proposed resolution
Register an adapter holding a weak reference to Drupal's guesser. Delegate while the guesser exists; report unsupported after collection so Symfony uses its remaining guessers.
User interface changes
None.
API changes
None.
Data model changes
None.
AI disclosure: I used AI to help prepare the IS and MR (Astra and Opus 5.5).
Issue fork drupal-3626372
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
ptmkenny commentedI'm adding an MR, but I'm not sure this is the right approach, so I set it to Draft and I'm setting this issue to "Needs work".