Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Propagate some errors in JSON chunker #14842

Closed
benibus opened this issue Dec 5, 2022 · 0 comments · Fixed by #14843
Closed

[C++] Propagate some errors in JSON chunker #14842

benibus opened this issue Dec 5, 2022 · 0 comments · Fixed by #14843
Assignees
Milestone

Comments

@benibus
Copy link
Collaborator

benibus commented Dec 5, 2022

Describe the bug, including details regarding any error messages, version, and platform.

The current JSON Chunker defers all error reporting to a later parsing stage when ParseOptions::newlines_in_values = true. However, this poses issues when sequentially chunking buffers. Consider this:

std::shared_ptr<Buffer> whole, rest;
// Trailing right-bracket
chunker->Process(Buffer::FromString("{\"a\":0}}"), &whole, &rest);

Here, whole will be {"a":0} but rest will be }, which doesn't start a valid JSON block. As such, for the next buffer, you can't then call ProcessWithPartial with rest as its partial argument without crashing (via DCHECK, if enabled). This effectively prevents us from handling the error at all.

Component(s)

C++

pitrou pushed a commit that referenced this issue Dec 5, 2022
* Closes: #14842

Authored-by: benibus <bpharks@gmx.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
@pitrou pitrou added this to the 11.0.0 milestone Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants