Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Mesenger] Add support for reseting container services between 2 messages#41163
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
ae3dc21 tod9b324aComparelyrixx commentedJul 23, 2021
Hello, I have rebased this PR, and addressed all comments. I should be OK now |
lyrixx commentedSep 1, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I could rebase this PR, but before doing so, I prefer to be sure it's mergeable. so WDYT? Edit: I have rebased the PR |
d9b324a toc52c434CompareJeroeny commentedSep 3, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
From my experience, a worker running without processing messages can also go out of memory. For example if you have an app running in debug mode the tracing/profiling will keep event-dispatcher events in memory, eventually causing the process to go out of memory. Because of this, should there also be a possibility to trigger the reset And continuing on that, would it be nice if you could do a reset when the worker is inactive (Can be read |
lyrixx commentedSep 3, 2021
Indeed, cf#32422
I don't understand :/
Indeed, that would be possible, in a next PR :) |
Jeroeny commentedSep 3, 2021
If I understood the logic in this PR correctly, a reset is only triggered by on of those |
lyrixx commentedSep 3, 2021
Ohhh, I see, good point. I need to check when the running event is triggered to ensure it does not break something |
Jeroeny commentedSep 3, 2021
I think it should be just as safe as the other events, it at least not during the handling of a message: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Messenger/Worker.php#L95 |
c52c434 tof0fbce3Comparelyrixx commentedSep 6, 2021
@Jeroeny Here we go 👍🏼 I pushed a new version where the listener listen |
fabpot left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you update the description to explain when and why one should enable or disable this flag? If you can create a PR on the docs, that would be the cherry on the cake :)
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…ssenger message.Without this patch, services are not resetted. For example MonologFinger Cross handler is never reset nor flushed. So if the firstmessage trigger and "error" level message, all others message will logand overflow the buffer.Usage with framework:```yamlframework: messenger: transports: async: dsn: '%env(MESSENGER_TRANSPORT_DSN)%' reset_on_message: true failed: 'doctrine://default?queue_name=failed' sync: 'sync://'```
f0fbce3 to488bb88Comparelyrixx commentedSep 10, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@fabpot I haved edited the PR description, and the configuration. |
fabpot commentedSep 10, 2021
Thank you@lyrixx. |
| ->tag('kernel.event_subscriber') | ||
| ->set('messenger.listener.stop_worker_on_stop_exception_listener', StopWorkerOnCustomStopExceptionListener::class) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is it correct that theStopWorkerOnCustomStopExceptionListener service looses thekernel.event_subscriber tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks, fixed in#43002
…rkerOnCustomStopExceptionListener (lyrixx)This PR was merged into the 5.4 branch.Discussion----------[Messenger] Add back kernel.event_subscriber tag on StopWorkerOnCustomStopExceptionListener| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes (but the bug was not released)| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |refs:#41163 (comment)Commits-------00a34c6 [Messenger] Add back kernel.event_subscriber tag on StopWorkerOnCustomStopExceptionListener
…rkerOnCustomStopExceptionListener (lyrixx)This PR was merged into the 5.4 branch.Discussion----------[Messenger] Add back kernel.event_subscriber tag on StopWorkerOnCustomStopExceptionListener| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes (but the bug was not released)| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |refs:symfony/symfony#41163 (comment)Commits-------00a34c623b [Messenger] Add back kernel.event_subscriber tag on StopWorkerOnCustomStopExceptionListener
…lyrixx)This PR was squashed before being merged into the 5.4 branch.Discussion----------[Messenger] document reset_on_message transport optionrefssymfony/symfony#41163Commits-------3f7ebce [Messenger] document reset_on_message transport option
Uh oh!
There was an error while loading.Please reload this page.
Without this patch, services are not resetted. For example Monolog
Finger Cross handler is never reset nor flushed. So if the first
message trigger and "error" level message, all others message will log
and overflow the buffer.
So, when a transport isasync (it means it is run in a worker), it's highly preferable to this configuration on
Usage with framework: