-
Notifications
You must be signed in to change notification settings - Fork 169
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
Make sure very large changesets in bootstraps do not crash the sync client #6220
Conversation
src/realm/sync/client.cpp
Outdated
} | ||
catch (const LogicError& ex) { | ||
if (ex.kind() == LogicError::binary_too_big) { | ||
IntegrationException ex(ClientError::bad_changeset, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can even throw bad_changeset_size
if you wanted it since there is both a ClientError and ProtocolError and we can translate it before sending to the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - makes me wonder if there are other errors we should be catching as well in the future, but definitely need to not crash in this case.
@ironage , could you take a look while @danieltabacaru is out? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine as a stopgap fix, but it is still bad news that the server can sometimes cause this unrecoverable error on a client. AFAIK, core doesn't actually need to enforce the size limit in this case because it is the history. IIRC Realm can store arbitrary length binaries and the only reason we restrict the length is because we want to respect MongoDB's server side limit. I'd expect that if we used a different API to set the binary which didn't do the size check, everything should just work?
Yeah, there's a server-side fix for this captured in BAAS-19105 and this is a stop-gap fix. |
What, How & Why?
This fixes the sync client so that if it receives a FLX bootstrap changeset larger than what can fit into a BinaryColumn, it treats that as a bad_changeset_size error and fails gracefully rather than crashing the process.
☑️ ToDos