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

Failure when converting short string to UTF-16 error_code = 1 #5668

Closed
tristangrichard opened this issue Jan 9, 2018 · 16 comments
Closed

Failure when converting short string to UTF-16 error_code = 1 #5668

tristangrichard opened this issue Jan 9, 2018 · 16 comments

Comments

@tristangrichard
Copy link

tristangrichard commented Jan 9, 2018

Running:

Realm 4.2.0
Fabric

Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Failure when converting short string to UTF-16 error_code = 1; retcode = 0; StringData.size = 16; StringData.data = Ma??sonnalité; StringData as hex =  0x4d 0x61 0xffffffb6 0x40 0x65 0x72 0x73 0x6f 0x6e 0x6e 0x61 0x6c 0x69 0x74 0xffffffc3 0xffffffa9; in_begin = ??sonnalité; in_end = ; out_curr = 0xbe95e374; out_end = 0xbe95e3d0; in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_UncheckedRow.cpp line 161
       at io.realm.internal.UncheckedRow.nativeGetString(UncheckedRow.java)
       at io.realm.internal.UncheckedRow.getString(UncheckedRow.java:157)
       at io.realm.ProfileRealmProxy.realmGet$secret_weapon(ProfileRealmProxy.java:1100)
       at io.realm.ProfileRealmProxy.createDetachedCopy(ProfileRealmProxy.java:3552)
       at io.realm.AccountRealmProxy.createDetachedCopy(AccountRealmProxy.java:2286)
       at io.realm.CollectionAccountRealmProxy.createDetachedCopy(CollectionAccountRealmProxy.java:968)
       at io.realm.DefaultRealmModuleMediator.createDetachedCopy(DefaultRealmModuleMediator.java:1064)
       at io.realm.Realm.createDetachedCopy(Realm.java:1598)
       at io.realm.Realm.copyFromRealm(Realm.java:1320)
       at io.realm.Realm.copyFromRealm(Realm.java:1293)
       at com.app.Fragments.Match.MatchFragment.lambda$afterViews$0$MatchFragment(MatchFragment.java:237)
       at com.app.Fragments.Match.MatchFragment$$Lambda$0.onChange(Unknown Source)
       at io.realm.internal.ObservableCollection$RealmChangeListenerWrapper.onChange(ObservableCollection.java:40)
       at io.realm.internal.ObservableCollection$CollectionObserverPair.onChange(ObservableCollection.java:21)
       at io.realm.internal.ObservableCollection$Callback.onCalled(ObservableCollection.java:65)
       at io.realm.internal.ObservableCollection$Callback.onCalled(ObservableCollection.java:55)
       at io.realm.internal.ObserverPairList.foreach(ObserverPairList.java:109)
       at io.realm.internal.OsResults.notifyChangeListeners(OsResults.java:472)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:323)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5438)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:762)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)

Line 237 is

realm.copyFromRealm(results.first());
@Zhuinden
Copy link
Contributor

Zhuinden commented Jan 9, 2018

I'm not sure why this would happen, is the Realm encrypted?

@tristangrichard
Copy link
Author

tristangrichard commented Jan 9, 2018

No, The most of our user are from the middle east and object can contain arabic characters!?!

@kneth
Copy link
Member

kneth commented Jan 9, 2018

@trr-amsiq 0xffffffb6 looks a bit odd. Do you know what Ma??sonnalité should be?

@tristangrichard
Copy link
Author

tristangrichard commented Jan 9, 2018

@kneth yes, it's French and should be Ma personnalité

String data should be StringData as hex = 0x4d 0x61 0x7f 0x70 0x65 ...

@kneth
Copy link
Member

kneth commented Jan 10, 2018

@trr-amsiq Does it happen when processing a push notification? I wonder if it has something to do with the lifecycle of the service (and a Realm instance).

@tristangrichard
Copy link
Author

tristangrichard commented Jan 10, 2018

@kneth No it does not. But the object being copied from realm can be updated by a push notification.

@kneth
Copy link
Member

kneth commented Jan 11, 2018

@trr-amsiq Do you by any chance have access to the Realm file? If you do, please send it to help@realm.io.

@tristangrichard
Copy link
Author

@kneth Sadly no. It is a production error

@Zey-Uzh
Copy link

Zey-Uzh commented Jun 6, 2018

I have the same problem. Lots of crashes on production (app use Realm 5.1.0).
My configuration:

new RealmConfiguration
                .Builder()
                .name(realmName)
                .schemaVersion(Constants.DB_VERSION)
                .directory(dbDir)
                .encryptionKey(key)
                .migration(MIGRATION)
                .initialData(INIT_REALM_TX)
                .build();

Android Studio version: 3.1.2

Stacktrace:
stacktrace 2018-06-06 10-21 (UTC).log

@Zey-Uzh
Copy link

Zey-Uzh commented Sep 12, 2018

Look like this issue related to #6152

@vladimirfx
Copy link

After upgrade to Realm 5.4.1 crash become native and increase frequency:
#6152

Android Studio: 3.1.4
Realm: 5.4.1 , 5.5.0
Android OS: 6.0 - 8.1

@fourplay45
Copy link

fourplay45 commented Oct 4, 2018

Same for us, we have quiet a bit of crashes like this:

Fatal Exception: io.realm.exceptions.RealmErrorUnrecoverable error. Failure when converting short string to UTF-16 error_code = 1; retcode = 0; StringData.size = 14; StringData.data = ㎠in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_UncheckedRow.cpp line 161 Raw Text
  | io.realm.internal.UncheckedRow.nativeGetString (SourceFile)
  | io.realm.internal.UncheckedRow.getString (SourceFile:157)

@clj0020
Copy link

clj0020 commented Apr 3, 2019

Also having this issue happen somewhat frequently in a production app.

@cmelchior
Copy link
Contributor

Should be fixed in 6.0.1 (not released yet), but 6.0.1-SNAPSHOT should be available. See https://github.com/realm/realm-java/blob/master/README.md#using-snapshots

@OlegNovosad
Copy link

Unrecoverable error. Failure when converting short string to UTF-16 error_code = 1; retcode = 0; StringData.size = 15; StringData.data = '� in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_UncheckedRow.cpp line 161

Got this with Realm 6.0.2

@cmelchior
Copy link
Contributor

@OlegNovosad Can you create a new issue with as much context as possible, e.g. the full stack trace, which device you are seeing it on, is encryption enabled.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants