fix: exclude event dispatcher from worker services reset#310
Closed
kochen wants to merge 1 commit intopatchlevel:3.16.xfrom
Closed
fix: exclude event dispatcher from worker services reset#310kochen wants to merge 1 commit intopatchlevel:3.16.xfrom
kochen wants to merge 1 commit intopatchlevel:3.16.xfrom
Conversation
0013176 to
e5ad9f2
Compare
ResetServicesListener calls ServicesResetter::reset() during WorkerRunningEvent dispatch. In debug mode, the global services_resetter includes debug.event_dispatcher (TraceableEventDispatcher), whose reset() clears dispatchDepth mid-dispatch — causing "Undefined array key" in postProcess() with symfony/event-dispatcher >= 8.0.8. Add WorkerResetCompilerPass that builds a worker-specific ServicesResetter excluding the debug.event_dispatcher, so the global resetter remains unchanged for HTTP request resets. Fixes patchlevel#309
e5ad9f2 to
baa36f0
Compare
Member
|
Closing as the issue #309 is resolved and released with https://github.com/patchlevel/event-sourcing-bundle/releases/tag/3.16.1 |
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.
Problem
ResetServicesListener::onWorkerRunningEvent()calls$servicesResetter->reset(), which resets all services tagged withkernel.reset— includingdebug.event_dispatcher(TraceableEventDispatcher) that is currently dispatching theWorkerRunningEvent.In
symfony/event-dispatcherv8.0.8,TraceableEventDispatcheraddeddispatchDepthtracking. Thereset()call clears$this->dispatchDepthmid-dispatch, causing an "Undefined array key" warning inpostProcess():Depending on error handling configuration, this warning is promoted to
ErrorException, breakingsubscription:bootandsubscription:runin debug mode.Fix
Add
WorkerResetCompilerPassthat, whendebug.event_dispatcheris present, builds a worker-specificServicesResetterexcluding the debug event dispatcher. TheResetServicesListeneris then rewired to use this filtered resetter.The global
services_resetterremains unchanged — HTTP request resets still include the event dispatcher as before.Changes
src/DependencyInjection/WorkerResetCompilerPass.php— new compiler passsrc/PatchlevelEventSourcingBundle.php— register the passtests/Unit/DependencyInjection/WorkerResetCompilerPassTest.php— unit testsFixes #309