Repository navigation
in_tcp: keep the connection and the other lines when the parser fails on a line - #5711
Merged
Merged
Conversation
When the parser raised on a line, the error reached the server helper. It closed the connection, and the other lines in the same read were lost. Rescue the parser error per line, log it as a warning, and go on. Errors raised while emitting are not parser errors, so they are re-raised. This is based on fluent#5640 by Rafay Qayyum. Co-authored-by: Rafay Qayyum <rafayqayyum786@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Mark the block as failed only when it raises. A parser that catches the block's error and re-raises it later no longer turns an emit error into a parse failure. Skip building the warn arguments when warn is off. Make the tests wait for the server thread instead of sleeping, and cover a parser error after the parser has yielded a record. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Timeout.timeout interrupts its block with Timeout::ExitException. A parser that wraps parse in Timeout.timeout could turn a slow emit into a parse failure. Also stop running the new test twice per data set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
kenhys
requested changes
Dec 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
kenhys
approved these changes
Dec 2, 2026
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 #5629
What this PR does / why we need it:
When the parser raised on a line, for example the json parser with
time_formatand a time that does not match, the error reached the server helper. It loggedunexpected error on reading dataand closed the connection. With batch emit, no line in that read was emitted. With single emit (<extract>withtag_key), the lines after the bad one were lost.Now in_tcp rescues the parser error per line and logs
failed to parse messageat warn level. Only the bad line is dropped, and the connection stays open. Errors raised while emitting are not parser errors, so they still reach the server helper as before.For a line that yields several records, such as a JSON array, the records yielded before the error are still emitted.
This also fixes the in_tcp side of #5691, where a UTF-8 regexp raises
Encoding::CompatibilityErroron a binary line.This supersedes #5640. It is the same change rebased onto master, with the review comments applied. The commit keeps the original author as a co-author.
Docs Changes:
None.
Release Note:
in_tcp: when the parser fails on a line, keep the connection and the other lines, instead of closing the connection and losing them.
🤖 Generated with Claude Code