Make bundle compatible with FrankenPHP worker mode#354
Merged
Conversation
HecFranco
force-pushed
the
frankenphp-worker-compatibility
branch
from
July 18, 2026 08:52
112b948 to
f4096b1
Compare
Reset in-memory log buffers and cookie jars between requests via kernel.reset so singleton clients do not leak state in long-lived workers.
HecFranco
force-pushed
the
frankenphp-worker-compatibility
branch
from
July 18, 2026 08:52
f4096b1 to
46c2171
Compare
Contributor
Author
|
Hi maintainers, |
Member
|
@HecFranco thanks for the contribution 👏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 pull request ensures EightPointsGuzzleBundle is safe to use in long-running PHP workers such as FrankenPHP worker mode (and similar runtimes where the Symfony container survives across HTTP requests).
Without proper service reset, singleton Guzzle clients and in-memory loggers can leak state between requests—leading to unbounded memory growth and unintended cookie sharing.
Motivation
In FrankenPHP worker mode, the PHP process and the service container remain alive between requests. Symfony relies on services tagged with
kernel.resetto clear request-scoped state.Prior to this change:
Loggeraccumulated messages (including request/response bodies) and was only cleared during profilercollect().HttpDataCollector::reset()did not clear attached loggers, sokernel.resetwithoutcollect()left buffers intact.options.cookies: true, Guzzle kept aCookieJaron the singleton client, allowing cookies to leak across unrelated Symfony requests.Changes
Logging & profiler
LoggerandDevNullLoggerimplementSymfony\Contracts\Service\ResetInterface.kernel.reset(method: reset).HttpDataCollector::reset()also clears attached loggers, covering the case where reset runs withoutcollect().Cookies
options.cookies: true, the extension injects a dedicatedGuzzleHttp\Cookie\CookieJarservice.kernel.reset(method: clear), so cookies are wiped between requests.Documentation
README.mdand noted inUPGRADE.md(no BC break).Backward compatibility
Fully backward compatible. No public API changes are required for consuming applications.
cookies: trueremains supported and becomes worker-safe.Testing
Logger::reset,DevNullLogger::reset, collector reset withoutcollect(),kernel.resettags, and resettable cookie jars.Checklist for reviewers
kernel.resettags on logger and cookie jar definitions.logging/profilingtied to%kernel.debug%).