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

fix(rdb_load): Handle JSON loading failure when parsing fails #4801

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BagritsevichStepan
Copy link
Contributor

Small fix for the case if we cannot parse json string during loading.

@BagritsevichStepan BagritsevichStepan self-assigned this Mar 19, 2025
if (json) {
pv_->SetJson(std::move(*json));
} else {
LOG(ERROR) << "Invalid JSON string";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this trigger errors in productions ? Is that something that we want ? cc @adiholden

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked other methods and they log ERROR for similar issues

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually print error log for internal error, when we do not expect to have failures.
Here in rdb load its iether that we had bug in snapshot serializing json incorrect or user tries to load some json but we can not parse it.
I do think that its worth to have an error print here. Please also print the blob string here so it will be easier to investigate if we see this error.
How did you get to this error flow stefan?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I agree with Adi here, it would be useful for us to be aware of those problematic flows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't reproduce it, but I checked the memory tracking, and during the check, I found out that if an error occurs (so the JSON should be empty), we are still trying to use the parsed value

kostasrim
kostasrim previously approved these changes Mar 19, 2025
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.

3 participants