in_tcp, in_syslog: a non-ASCII delimiter closes the connection with Encoding::CompatibilityError
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Read lib/fluent/plugin/in_tcp.rb around lines 126 and 176, then inspect the TCP transport path in lib/fluent/plugin/in_syslog.rb around line 252. Reproduce with the provided delimiter and socket example, and check related tests for TCP and syslog parsing. Done means non-ASCII delimiters either split messages correctly without closing the connection or are rejected in configuration; the issue does not name a specific test file.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
in_tcp closes the connection when the delimiter contains a non-ASCII character, such as delimiter "§", and the received data contains a non-ASCII byte.
The data read from the socket is ASCII-8BIT. When the connection buffer gets a non-ASCII byte, the buffer becomes ASCII-8BIT too. The delimiter from the configuration is UTF-8, so buf.index(@delimiter, pos) raises Encoding::CompatibilityError. The server helper logs the error and closes the connection.
Data that contains such a delimiter always contains a non-ASCII byte. So a non-ASCII delimiter can never split messages. Data with only ASCII bytes does not raise, but it is not split either.
in_syslog with <transport tcp> has the same problem. It raises at in_syslog.rb:252.
To Reproduce
-
Run Fluentd with the configuration below.
-
Send two messages that end with the delimiter:
ruby -rsocket -e 's = TCPSocket.new("127.0.0.1", 5170); s.write("hello§world§"); puts(IO.select([s], nil, nil, 3) ? "closed by server" : "still open")'It prints
closed by server, and no record is emitted.
Expected behavior
hello and world are emitted. If non-ASCII delimiters are not supported, the configuration is rejected instead.
Your Environment
- Fluentd version: 1.20.1 (master at 1d6b1129)
- Package version: N/A (from source)
- Operating system: CachyOS
- Kernel version: 7.3.1-1-cachyos
- Ruby: 4.0.9
Your Configuration
<source>
@type tcp
tag test
port 5170
bind 127.0.0.1
delimiter "§"
<parse>
@type none
</parse>
</source>
<match test>
@type stdout
</match>
Your Error Log
2026-11-06 12:31:44 +0900 [error]: unexpected error on reading data host="127.0.0.1" port=51668 error_class=Encoding::CompatibilityError error="incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8"
2026-11-06 12:31:44 +0900 [error]: lib/fluent/plugin/in_tcp.rb:176:in 'String#index'
2026-11-06 12:31:44 +0900 [error]: lib/fluent/plugin/in_tcp.rb:176:in 'block in Fluent::Plugin::TcpInput#start'
2026-11-06 12:31:44 +0900 [error]: lib/fluent/plugin_helper/server.rb:661:in 'on_read_with_connection'
2026-11-06 12:31:44 +0900 [error]: cool.io-1.11.0/lib/cool.io/io.rb:123:in 'Coolio::IO#on_readable'
Additional context
With <extract>, the same error is raised at in_tcp.rb:126.
del_size is @delimiter.length, which counts characters, not bytes. Matching the delimiter as bytes might fix both. I have not tested it.
- Ngôn ngữ chính
- Ruby
- Star
- 13.6k
- Fork
- 1.4k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 61
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fluent/fluentd
-
in_tcp: skip emitting an empty event stream when a read has no complete messageCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
fluent/fluentd#5494 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BufferChunkOverflowError inside @ERROR loops forever - no buffer parameter can stop itCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
fluent/fluentd#5462 · 8 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
<system> umask` / `--umask` is not applied to worker-created files under a foreground supervisorCó thể làm lại được @mbmtbtbc đã nhận 115 ngày trước và không có pull request nào đang mở. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fluent/fluentd#5435 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fluent/fluentd
Issue tương tự
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
swombat/souls-house#825 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openhab/openhab-jruby#571 ·
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
chatwoot/chatwoot#16591 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày