realm-java: ThrowingException 16, std::exception in io_realm_internal_TableQuery.cpp line 1288

After ThrowingException 16, std::exception in io_realm_internal_TableQuery.cpp line 1288 exception is logged, i can’t

  1. load data using Observable (Observable’ s onNext not called, only ThrowingException 16, std::exception in io_realm_internal_TableQuery.cpp line 1288 is logged in logcat)
  2. load data synchronously (Requested table is not in this Realm. Creating it requires a transaction exception happens)
  3. insert data. Whenever i insert data, A RealmObject with no @PrimaryKey cannot be updated error happened, although that class has a @PrimaryKey annotated field.
  4. finally initialize Realm with ArrayIndexOutOfBoundsException: columnIndex > available columns.exception

Case 1~3 dismiss after process is restarted (swipe it in recent tasks), but i could reproduce below steps. After case 4, i uninstalled application and no longer reproduce any of problems.

Steps & Code to Reproduce

The class that have this problem query data and is listening changes (using observable) in main thread. At the same time every data about that class are removed (realm.delete(*.class)) and re-inserted with fresh one from server in worker thread.

I tried to find reproduce step for 1~2 hours, but i couldn’t.

Version of Realm and tooling

Realm version(s): 1.0.0

Android Studio version: 2.1.1

Which Android version and device: 6.0.1 (Galaxy S6)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (20 by maintainers)

Most upvoted comments

@Zhuinden each individual element is being saved in a single transaction. For each element being downloaded, I have to load up an existing parent object and save the new object within it. If the parent doesn’t exist, I have to first create it, before adding the new object to it.

The elements aren’t being downloaded in any particular order, so I don’t think I can group and save them in one transaction.

@cmelchior I’ll enable full logging and see what that uncovers right now, and I’ve raised the question with the team to find out what I can share with you.

Out of memory should crash the app outright. Are you catching Errors somewhere?

Regarding upgrading. The list of breaking changes is here: https://github.com/realm/realm-java/blob/master/CHANGELOG.md#breaking-changes-1

@CDRussell No, i’ll re-open this instead. Please provide as many details you can

Hi @hohnamkung I think we have identified an interaction between asynchronous listeners and synchronous RealmResults that could result in errors. Some of these errors will be solved by https://github.com/realm/realm-java/pull/2926, but we discovered it did not cover all corner cases.

However these errors should not result in some of error messages you are seeing, e.g Requested table is not in this Realm. Creating it requires a transaction still indicate that a Realm file with a wrong schema is being accessed.