Skip to content

in_tcp: drop only the line that the parser fails on - #5644

Closed
Shriraj1901 wants to merge 1 commit into
fluent:masterfrom
Shriraj1901:fix-in-tcp-parser-error
Closed

Shriraj1901 wants to merge 1 commit into
fluent:masterfrom
Shriraj1901:fix-in-tcp-parser-error

Conversation

@Shriraj1901

Copy link
Copy Markdown

When @parser.parse raised an error for a line (for example ParserError from the json parser when the time field does not match time_format), the error was not rescued in in_tcp. It went up to the server helper, which logged "unexpected error on reading data" and closed the connection.

With batch emit the lines that were already parsed in the same read were not emitted, and with single emit the lines after the bad line were lost. One bad line from a client dropped its valid lines.

Rescue ParserError per line, log a warning and go on with the next line, as is done for a line that doesn't match the pattern.

Fixes #5629

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:

Docs Changes:

Release Note:

When @parser.parse raised an error for a line (for example ParserError
from the json parser when the time field does not match time_format),
the error was not rescued in in_tcp. It went up to the server helper,
which logged "unexpected error on reading data" and closed the
connection.

With batch emit the lines that were already parsed in the same read were
not emitted, and with single emit the lines after the bad line were
lost. One bad line from a client dropped its valid lines.

Rescue ParserError per line, log a warning and go on with the next line,
as is done for a line that doesn't match the pattern.

Fixes fluent#5629

Signed-off-by: shreeraj <shreerajjadhav19@gmail.com>
@Watson1978

Copy link
Copy Markdown
Contributor

Thank you for working on this. #5640 was opened a few hours earlier for the same issue, with a similar change and the same test inputs, so I'm closing this one as a duplicate. Sorry about the overlap.

@Watson1978 Watson1978 closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in_tcp: a parser error drops the other lines in the same read and closes the connection

2 participants