tls: yield downstream read retries to the event loop [Backport to 5.0]#12141
tls: yield downstream read retries to the event loop [Backport to 5.0]#12141cosmo0920 wants to merge 8 commits into
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e2a2a441e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ret = flb_io_net_read(conn->connection, | ||
| conn->buf + conn->buf_len, avail); |
There was a problem hiding this comment.
Bound secure-forward reads to the allocated buffer
When secure-forward is enabled and buffer_chunk_size is configured below 1023, conn->buf is only that configured size, but check_ping() calls this helper with size == 1023, so flb_io_net_read() can write past the end of conn->buf before msgpack validation runs. Please cap avail by conn->buf_size - conn->buf_len or grow the connection buffer before reading the PING.
Useful? React with 👍 / 👎.
| } | ||
| else if (ret == FLB_TLS_WANT_WRITE) { | ||
| if (event_driven) { | ||
| if (io_tls_event_switch(session, MK_EVENT_READ | MK_EVENT_WRITE) == -1) { |
There was a problem hiding this comment.
Preserve custom event dispatch for TLS write retries
When a downstream TLS read returns FLB_TLS_WANT_WRITE, this new path calls io_tls_event_switch(), whose mk_event_add(..., FLB_ENGINE_EV_THREAD, ...) re-registers the already-registered input/http-server connection as a thread event instead of the FLB_ENGINE_EV_CUSTOM handler it was using. In the normal downstream input registrations there is no coroutine waiting for that follow-up writable notification, so the engine consumes the event without invoking the connection handler and the TLS connection can remain stuck in the retry state; preserve the existing event type/handler when switching the mask.
Useful? React with 👍 / 👎.
Partially backporting of #12140 due to lack of integration testing infrastructure.
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-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
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.