-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input: disable coroutines for custom events and input callbacks that do not support coroutines. #9338
Conversation
Food for thought: what would be the complexity of modifying the input event dispatcher to actually use coroutines? I don't know if I'm missing a big deal or if the simplistic approach would be too awful performance wise but for some reason I think it shouldn't be hard to pull off. In a way I think it'd be preferable to leave this PR on hold for a few days and give that one a try because it could be quite beneficial performance wise and I think it would be better to address the issue now that we have a clear picture of what the problem is rather than working around it and leaving it for someone to uncover in the future but I understand that this request can be a bit frustrating. |
Thanks for opening this PR.
I am wondering if this is fixing the root cause of the problem or is just a workaround. what about if we schedule a call and we walk through this ? |
I am all for it but hadn't taken the time yet to attempt that approach. One problem might be how to handle custom events since we cannot be sure if that is registered to an input or an output plugin, but its possible that distinction might make no difference.
I agree. I do not necessarily think this needs to be the final fix for this issue but I did feel the need to present it.
👍 |
Signed-off-by: Phillip Adair Stewart Whelan <[email protected]>
Signed-off-by: Phillip Adair Stewart Whelan <[email protected]>
18653cc
to
ecdff84
Compare
Signed-off-by: Phillip Whelan <[email protected]>
I ran the
The tests pass and do not leak any memory. The following code sets all connection to Line 324 in 58c1330
It is called in There is also no |
… flb_tls_session_create. Signed-off-by: Phillip Whelan <[email protected]>
…do not support coroutines. (fluent#9338) * io: respect async connection flag in flb_io_net_connect. * tls: respect async connection flag in flb_tls_session_create. Signed-off-by: Phillip Adair Stewart Whelan <[email protected]>
Summary
Code that does not specifically support coroutines can result in a segmentation fault when coroutines are used during I/O and network calls. Under most circumstances this should not occur but if an input plugin shares the same thread as any output plugin that can inadvertently enable coroutines for all input plugins as well as causing custom events to use coroutines as well.
This PR mitigates this by juggling out the thread local storage used by coroutines during collect callbacks for non-coroutine inputs as well as custom events which do not have a way to express their compatibility with coroutines.This PR has been refactored so that both the
flb_io_net_connect
andflb_tls_session_create
functions respect theFLB_IO_ASYNC
flag instead of assuming it when coroutines have been initialized.This also mitigates the issue for
FLB_ENGINE_EV_CUSTOM
:Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
I have backported this PR to the 3.0 and 3.1 series:
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.