input: set FLB_IO_TCP_KA flag in flb_input_upstream_set - #12096
Open
labros-mediaalpha wants to merge 1 commit into
Open
input: set FLB_IO_TCP_KA flag in flb_input_upstream_set#12096labros-mediaalpha wants to merge 1 commit into
labros-mediaalpha wants to merge 1 commit into
Conversation
flb_upstream_conn_get() derives a new connection's initial recycle state from flb_stream_is_keepalive(), which checks the FLB_IO_TCP_KA stream flag -- not net.keepalive directly. flb_output_upstream_set() sets this flag from ins->net_setup.keepalive; flb_input_upstream_set() did not, so connections for any input plugin using this function never recycled regardless of net.keepalive. Mirrors the existing logic in flb_output_upstream_set() (src/flb_output.c). This likely affects in_kubernetes_events and in_calyptia_fleet as well, since they call flb_input_upstream_set() too -- not independently verified, worth re-testing. Ref fluent#12094 Signed-off-by: Labros Chaidas <labros@mediaalpha.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughInput upstream setup now enables the ChangesInput upstream keepalive
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR description was AI-assisted (Claude Code).
What does this PR do?
flb_input_upstream_set()copiesnet.*config into the upstream'snet_setupstruct, but never sets theFLB_IO_TCP_KAstream flag thatflb_upstream_conn_get()actually checks when deciding a newconnection's initial recycle state. This mirrors the equivalent, already
correct logic in
flb_output_upstream_set().Companion PR (#12095) adds the missing
flb_input_upstream_set()callto
in_prometheus_scrape; neither PR alone restores connection reuse —verified empirically, see #12094.
Impact
Affects every input plugin calling
flb_input_upstream_set():currently
in_prometheus_scrape(companion PR),in_kubernetes_events,and
in_calyptia_fleet. The latter two were not independentlyre-tested against this fix — flagging for maintainer visibility since
their existing "fix" may not have been fully effective either.
Testing
Verified via
-vvdebug logging and tcpdump packet capture on a livev5.0.7 instance: without this fix,
in_prometheus_scrapeconnectionsare torn down and recreated every scrape cycle even with
net.keepaliveon and the companion PR's
upstream_set()call in place. With this fix,connections are created once and recycled on subsequent scrapes.
Ref #12094
Summary by CodeRabbit