-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Unrecoverable error. Failure when converting to UTF-8 #1756
Comments
Can you say what values of the stings are in that object? Moreover, which version of Realm? Was the Realm created under the same version of Realm? Do you use encryption? |
|
0xd83d 0xd83d is an invalid sequence in UTF-16 because both are high surrogates. High surrogates(d800-dbff) must be followed by low surrogates(dc00-dfff). |
As @zaki50 points out, it is not a valid UTF-16 sequence. Can you tell us which emoji it is (http://punchdrunker.github.io/iOSEmoji/table_html/)? |
@AKlimashevskyCedon Was your Realm created under iOS? |
Hey, We see a similar error in our crash reporting:
I currently cannot tell what the Java string value is, but we will can add a tracking for that. Concerning the RealmError, does this make the Realm instance unusable? As this basically is a type error is it not possible to throw and Exception from which the app can recover? Edit: |
It is safest to close the app when a |
I will try to get that information, but this might take some time, as we need to release a new version which includes this information in the crash tracking. My point was, when I looked where the error occurs in native code you see that it is before any changes are made to the Realm (
realm-java/realm/realm-jni/src/util.cpp Line 409 in 05fa8b0
Currently the only way to prevent the error in our app, would be to validate the String beforehand on Java side, which I don't know how. |
No, you shouldn't validate all strings. My interest in the Java string is to use it to see if I can reproduce it more directly with our string conversion (and see if there is a bug triggered by very rare cases). |
I will send you the string as soon as I get my hands on one, but as mentioned I will take about a week 😕 |
Update: it seems, that this is an Android issue. As surrogate pair can be separated by methods like I still would expect that to be an Exception and not an Error on Realm side. For me it is kind of confusing. I try to insert an invalid string (which is basically an InvalidArgumentException) and Realm reports back a RealmError (which indicates that it is an unrecoverable error and the app needs to be restarted) |
@rimeissner Thanks for the update. The question of Exception vs. Error boils down to whether an app can recover for the situation and "do the right thing". And maybe we at Realm are a bit pessimistic - we chose Error to be sure that the Realm file wasn't corrupted. It might be a good time to reconsider! |
In general I agree to that. But as for as I understand the code in this case, this happens before any call to the realm-core is made. So the realm file should not be corrupted (even so that transaction should probably be canceled and nothing should be written to the Realm). Either way, this thread was a great help figuring out the problem 😃. Should I send you some "cut-off" strings for testing? |
If you have some interesting strings, I would love to include them in our tests! You're welcome to send them to help@realm.io. |
I can post them here. These are the one we use in our tests: |
@rimeissner I have merged a pull request which implements your suggestion. You can try it using the 0.88 snapshot release in a short while or wait a bit longer for 0.88 to be released. |
Cool, I will try out the new version 👍 |
Caused by: io.realm.exceptions.RealmError: Unrecoverable error. Failure when computing UTF-16 size error_code = 5; retcode = 56; StringData.size = 74; StringData.data = http://img4.bitautoimg.com/autoalbum/files/20160AAAA in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_UncheckedRow.cpp line 136 version 2.0.2 |
@zhangwenjia616 Do you have access to the Realm file or the complete stack trace? |
I've had a similar crash: The devices where I've noticed this so far are: HUAWEI VNS-L31 and HUAWEI G6-L11 |
@grobarko Do you have an idea what the string should be? Your crash says that the string should be 36 characters long but is only |
I got a similar issue, does this copy pasta from my crash logs help?
|
@eddieberklee I would like to know Realm version, and info about the device. |
realm verson
classpath "io.realm:realm-gradle-plugin:2.2.1"
[image: Inline image 1]
…On Mon, May 22, 2017 at 1:33 PM, Kenneth Geisshirt ***@***.*** > wrote:
@eddieberklee <https://github.com/eddieberklee> I would like to know
Realm version, and info about the device.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbd_76tAdiJgf1N0wkGoA_H41qbUZks5r8fE0gaJpZM4GgKw->
.
|
@eddieberklee do you use encryption? |
Nope
…On Tue, May 23, 2017 at 3:26 PM, Gabor Varadi ***@***.***> wrote:
@eddieberklee <https://github.com/eddieberklee> do you use encryption?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbRAb8wOXe6Wmh8sr-OkAXyeO2Rr2ks5r810TgaJpZM4GgKw->
.
|
@eddieberklee Error code 6 indicates Incomplete surrogate pair. Character 0xd83d can be part of an iOS smiley. Does that sounds something which is related to your app? |
Yeah that's definitely a possibility. I run a journaling app on top of
Realm. So Realm doesn't support emoji unicodes??
Ed
…On Mon, May 29, 2017 at 4:06 AM, Kenneth Geisshirt ***@***.*** > wrote:
@eddieberklee <https://github.com/eddieberklee> Error code 6 indicates
Incomplete surrogate pair. Character 0xd83d can be part of an iOS smiley.
Does that sounds something which is related to your app?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbT2CxS_2Vkwqy9XKKdW3IAlEkoCQks5r-qaqgaJpZM4GgKw->
.
|
@eddieberklee Realm supports emoji. The problem is that your String is ending with https://en.wikipedia.org/wiki/UTF-16#U.2B10000_to_U.2B10FFFF |
Any ideas on how this might have happened? It's not possible to just type
this high surrogate character in and of itself, from what it sounds like
…On Mon, May 29, 2017 at 11:34 AM, Makoto Yamazaki ***@***.***> wrote:
@eddieberklee <https://github.com/eddieberklee> Realm supports emoji. The
problem is that your String is ending with 0xd83d.
0xd83d is a high surrogate character and it must be followed by low
surrogate (0xdc00-0xdfff) to be valid UTF-16 string.
https://en.wikipedia.org/wiki/UTF-16#U.2B10000_to_U.2B10FFFF
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbV7u5amNAcqXdfKCCzYJKY7WIY5Aks5r-w-lgaJpZM4GgKw->
.
|
Any method in Java that operates on chars instead of unicode code points have the potential to corrupt strings with emojii. Most (if not all) methods on String only operate on chars, so things like |
Hmm ok, must be incorrect string manipulation on my end then. Seems like
something Realm could safeguard against as well though?
…On Mon, May 29, 2017 at 12:13 PM, Christian Melchior < ***@***.***> wrote:
Any method in Java that operates on chars instead of unicode code points
have the potential to corrupt strings with emojii. Most methods on String
only operate on chars, so things like substring() and reverse() could
both cause this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbbLXFJRgDZ0IXKzT-ayDK-rJpFPwks5r-xjngaJpZM4GgKw->
.
|
@eddieberklee We do have checks (unlike SQLite) during insertions, and I am a bit surprised to see that the error message when reading from the Realm file. But in version 3.1.0 we fixed a unreported bug which could lead to corruption of Realm files. I suggest that you upgrade if possible. |
Yeah, 3.1.4 and 3.3.1 are good versions |
Thanks a lot guys - I've updated my Realm version and I'll let you know if
I see this error again.
…On Tue, May 30, 2017 at 1:39 AM, Gabor Varadi ***@***.***> wrote:
Yeah, 3.1.4 and 3.3.1 are good versions
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwGbZu1ADjldXSqKI1CUgCkFBzuxTE-ks5r-9WvgaJpZM4GgKw->
.
|
The property in question is a Realm version: 3.3.1 |
@jpmcosta That is interesting. It looks like the setter is being delegated to the wrong underlying property. Can you create a new issue with the model class in question? |
I get this error due to substring(), I might have accidentally split the emoji |
I get this error when try to save an object.
io.realm.exceptions.RealmError: Unrecoverable error. Failure when converting to UTF-8; error_code = 7; 0xd83d 0xd83d in io_realm_internal_UncheckedRow.cpp line 298
The text was updated successfully, but these errors were encountered: