-
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
downstream: PR 6882 rework #6906
Conversation
input: additionally, changed the stream parameter type to make the client code simpler. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
Removed a stored reference to the main event loop in favor of obtaining the current event loop pointer from the TLS which is required to prevent client sockets from being registered in the main thread when the plugin instance is running in its own thread. Additionally, a call to flb_input_downstream_set was added in order to enable thread safety and move the downstream to the plugin instance downstream list if needed in order to ensure that the downstream is processed by the timeout callback runing in the plugins thread instead of the main thread. Signed-off-by: Leonardo Alminana <leonardo@calyptia.com>
the changes makes sense to me, but we need more testing. @nokute78 can you validate the approach proposed here ? |
I just realized that the test case I created for this has already been running for 24 hours when I went to switch branches to backport it to 2.0. The configuration I used was this :
The clients were eight shells running this line :
And the contents of
Which obviously is wrong considering this is So I am fairly confident that this PR works. |
@leonardo-albertovich Thank you for reworking. Note: Side effect of thread sanitizer ? I tested following configuration and enabled thread sanitizer. If I disabled thread sanitizer, the receiver worked correctly. Receiver:
Sender:
Note: Detail of the PR is |
I think once we move the atomic operation abstraction layer from cmetrics to cfl we'll be in a much better position to fix that race in a performant way. I think it's about time we move atomics to cfl, it's not the first time I've been in a situation where I'd like to use them outside of cmetrics and from a purely organizational point of view it would make sense (which I don't think anyone disagrees with). |
This pull request addresses the same issues that PR #6882 covered.