Repository navigation
in_tcp: keep the message_length_limit discard state per connection - #5648
Closed
Raed2180416 wants to merge 1 commit into
Closed
Raed2180416 wants to merge 1 commit into
Raed2180416 wants to merge 1 commit into
Conversation
discard_till_next_delimiter was a local variable of start, so every connection shared it. When one connection exceeded message_length_limit and had its buffer cleared, the flag stayed set, and the next delimiter from any connection, whichever came first, was dropped as if it were the tail of the long message. The rest of the long message was then emitted as a record, because the flag was already reset when its own delimiter came. Move the flag into the connection block, as in_syslog already does, so each connection discards only its own data until its own next delimiter. The read loop is unchanged apart from that scope. Fixes fluent#5647 Signed-off-by: Raed <Raed2180416@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Contributor
|
Thank you for the fix and the clear test. #5624 already includes the same change in its commit 185ee75. With it, in_tcp keeps the discard flag for each connection, as in_syslog does. I checked that both examples in #5647 are fixed on the current head of #5624. The two PRs change the same block of in_tcp, so I'm closing this one in favor of #5624. |
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.
Which issue(s) this PR fixes:
Fixes #5647
What this PR does / why we need it:
in_tcpkeptdiscard_till_next_delimiterin a local variable ofstart, so every connection shared it. When one connection sent more thanmessage_length_limitbytes without a delimiter, its buffer was cleared and the flag was set. The next delimiter to arrive then reset the flag and was dropped, even when it came from another connection, and the rest of the long message was emitted as a record, because the flag was already reset by the time its own delimiter came.This moves the flag into the connection block, as
in_syslogdoes for the same flag, so a connection discards only its own data until its own next delimiter. The read loop is otherwise unchanged.server_createis replaced withserver_create_connectionso the block runs once per connection anddiscard_till_next_delimiteris a per-connection local. The client check stays inside the data callback, so when a disallowed client is closed does not change.With two connections,
message_length_limit 10, and@type none:Before:
["tail", "world"]— B's line is lost and the tail of A's long message is emitted. After:["hello", "world"].Verified:
bundle exec ruby -Ilib -Itest test/plugin/test_in_tcp.rb— the new testdiscard only the data of the connection that exceeded the limitfails on master with<["hello", "world"]> expected but was <["tail", "world"]>for both the batch-emit and single-emit paths, and the file passes 32 tests, 75 assertions, 0 failures after the change.rubocop lib/fluent/plugin/in_tcp.rb test/plugin/test_in_tcp.rbreports no offenses.Docs Changes:
N/A
Release Note:
in_tcp: keep the message_length_limit discard state per connection