engine: fix high memory usage in FluentLogEventRouter#4996
Conversation
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
|
Thanks! However, it appears to me that we have to be very careful about changing this starting order. For example, it would cause a bug if events are emitted without some plugins started. |
|
It might be better to implement #1504 instead of this change. |
I can't understand that the current is safe because it is already known to cause memory leaks. |
I don't mean to say the current code is entirely safe. |
I see! |
I think FluentLogEventRouter handles log routing. |
|
We need another approach to fix this |
Which issue(s) this PR fixes:
Fixes #4994
What this PR does / why we need it:
Previously,
FluentLogEventRouterwas designed to start processing only after the worker had started.As a result, if a large number of warnings were emitted by the
in_tailplugin immediately after the worker started,lots of warning messages would accumulate in the
FluentLogEventRouter's queue.And it consumes a significant amount of memory.
This PR changes the behavior so that
FluentLogEventRouterstarts processing before the worker is fully started, allowing it to consume the message queue immediately.With this change, memory usage is significantly reduced compared to the previous implementation.
Here is the memory usage was obtained using the same operation as #4994.

FYI)
You can confirm the memory usage easily with the following sample code.
Docs Changes:
Release Note: