Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-470

ExternalCommitHelper cannot find table

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: ObjectStore

      Discovered in Java https://github.com/realm/realm-java/issues/7054

      There seems to be a problem with Core 6 and Notifications in some corner cases. The above error is a sporadic bug we are seeing in Java.

         @Test
          @RunTestInLooperThread
          public void refresh_triggerNotifications() {
              final CountDownLatch bgThreadDone = new CountDownLatch(1);
              final AtomicBoolean listenerCalled = new AtomicBoolean(false);
              Realm realm = looperThread.getRealm();
              RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
              assertEquals(0, results.size());
              results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() {
                  @Override
                  public void onChange(RealmResults<AllTypes> results) {
                      assertEquals(1, results.size());
                      listenerCalled.set(true);
                  }
              });
      
              // Advance the Realm on a background while blocking this thread. When we refresh, it should trigger
              // the listener.
              new Thread(new Runnable() {
                  @Override
                  public void run() {
                      Realm realm = Realm.getInstance(looperThread.getConfiguration());
                      realm.beginTransaction();
                      realm.createObject(AllTypes.class);
                      realm.commitTransaction();
                      realm.close();
                      bgThreadDone.countDown();
                  }
              }).start();
              TestHelper.awaitOrFail(bgThreadDone);
      
              realm.refresh();
              assertTrue(listenerCalled.get());
              looperThread.testComplete();
          }
      

      This is the Java test. Basicially it just does a background write and ensures that calling Realm.refresh() correctly trigger notifications.

            Assignee:
            finn.schiermer-andersen@mongodb.com Finn Andersen (Inactive)
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: