You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for being a bit late to this party. I just saw that #41163 got merged into 5.4 and I think it needs a bit more polish. The main issue I found with it is that IMHO it's way too agressive. If reset_on_message is enabled on a transport, the services in ServicesResetter (which are quite a few) will get reset
while (true) {
// worker tick
foreach (transport) {
if (message) {
reset (success/failed)
reset again (worker running) <-- actually, this would throw
}
}
if (idle) {
reset again
}
usleep
Isn't this too aggresive? While resetting after each message (success/failure) makes some sense (though there's an argument to be made for a userland implementation), resetting multiple times per worker tick can't be all right. It also reset on each tick if idle. Depending on the configuration, it can happen multiple times per second.
ServicesResetter was meant for resetting state on request boundaries. It was never meant to hide memory leaks. Sure, it does help cover the memory leaks, but covering them is not a viable long term solution.
The original PR pointed out at least 2 legitimate issues: The FingersCrossedHandler keeps on flushing logs after a single error and the Profiler infrastructure is leaking memory. While the monolog issue should be fixed, I don't find the Profiler argument convincing. I do believe the profiler should not leak memory, but I think the Profiler should do its own housekeeping in a messenger context.
Another issue with the current implementation is the fact the it subscribes to WorkerRunningEvent and then it calls getReceiverName() on it. WorkerRunningEvent::getReceiverName() does not exist. That's because WorkerRunningEvent doesn't extend AbstractWorkerMessageEvent (which ResetServicesListener::resetServices() expects).
Last but not least, there's the semantic issue -- right now, the configuration reset_on_message is misleading.
Some ideas that would improve the situation would be:
reset the services only on message handled (success or failed)
maybe even reset on idle, but do it a lot less often (and toggleable separately, or at least make it clear to the developer that reset_on_message_also_resets_on_idle)
just like there is cache.app and a cache.system, maybe the ServicesResetter should have separate service groups for app and system. The framework would do its own housekeeping, while userland that has no other choice would tag their services to get reset as well as part of the app group)
I know it's a long shot, but if we extended the profiler to work for CLI usecases (like messenger), it would give us a chance to mitigate some of the leaks. The profiler would collect() the data and the Collectors (like TraceableEventDispatcher) would have their buffers cleared.
So... what do you guys think?
/cc @lyrixx (please forgive me 😁 )
The text was updated successfully, but these errors were encountered:
carsonbot
added
the
RFC
RFC = Request For Comments (proposals about features that you want to be discussed)
label
Sep 13, 2021
reset the services only on message handled (success or failed)
As you can see, the subscription on WorkerRunningEvent was added very late to the PR.
I think you are right, so I'll open a new PR to remove it 👍🏼
maybe even reset on idle, but do it a lot less often (and toggleable separately, or at least make it clear to the developer that reset_on_message_also_resets_on_idle)
I'm not sure it's really needed. Actually I don't have issues when the controller is idle. So let's drop this feature completely
(This option should not hide leak in the first place, I agree with you)
just like there is cache.app and a cache.system, maybe the ServicesResetter should have separate service groups for app and system. The framework would do its own housekeeping, while userland that has no other choice would tag their services to get reset as well as part of the app group)
That's another topic. If you think it could be really useful, please open a new RFC (in the DIC / Kernel section)
Indeed, I saw the Idle listener was added late in the PR and I agree it's not needed. It's only "needed" because of the Profiler infrastructure leaking constantly in CLI.
Removing the idle listener fixes the core issues with this uhm... issue :)
The other points are maybe appropriate for future RFCs, as you pointed out :)
Nonetheless, if you deem it appropriate, I would welcome keeping this issue open a little while longer for some more thoughts on the ideas. If not, let me know so I start drafting them 👍
Hello,
Sorry for being a bit late to this party. I just saw that #41163 got merged into 5.4 and I think it needs a bit more polish. The main issue I found with it is that IMHO it's way too agressive. If
reset_on_message
is enabled on a transport, the services inServicesResetter
(which are quite a few) will get resetIsn't this too aggresive? While resetting after each message (success/failure) makes some sense (though there's an argument to be made for a userland implementation), resetting multiple times per worker tick can't be all right. It also reset on each tick if idle. Depending on the configuration, it can happen multiple times per second.
ServicesResetter was meant for resetting state on request boundaries. It was never meant to hide memory leaks. Sure, it does help cover the memory leaks, but covering them is not a viable long term solution.
The original PR pointed out at least 2 legitimate issues: The
FingersCrossedHandler
keeps on flushing logs after a single error and the Profiler infrastructure is leaking memory. While the monolog issue should be fixed, I don't find the Profiler argument convincing. I do believe the profiler should not leak memory, but I think the Profiler should do its own housekeeping in a messenger context.Another issue with the current implementation is the fact the it subscribes to
WorkerRunningEvent
and then it callsgetReceiverName()
on it.WorkerRunningEvent::getReceiverName()
does not exist. That's becauseWorkerRunningEvent
doesn't extendAbstractWorkerMessageEvent
(whichResetServicesListener::resetServices()
expects).Last but not least, there's the semantic issue -- right now, the configuration
reset_on_message
is misleading.Some ideas that would improve the situation would be:
reset_on_message_also_resets_on_idle
)cache.app
and acache.system
, maybe theServicesResetter
should have separate service groups for app and system. The framework would do its own housekeeping, while userland that has no other choice would tag their services to get reset as well as part of theapp
group)collect()
the data and the Collectors (likeTraceableEventDispatcher
) would have their buffers cleared.So... what do you guys think?
/cc @lyrixx (please forgive me 😁 )
The text was updated successfully, but these errors were encountered: