Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-698

Terminating app due to uncaught exception 'RLMException', reason: 'ConstIterator copy failed'

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

      Goals

      Use Realm to perform basic database operations

      Expected Results

      App should not encounter any Realm-related crashes

      Actual Results

      App crashes with the following log:
      Terminating app due to uncaught exception 'RLMException', reason: 'ConstIterator copy failed'

      Steps to Reproduce

      The issue is intermittent. Crash happens when all objects are deleted using

      try realm.write {
         realm.deleteAll()
      }
      

      and try to perform operations like realm.add(objects, update: update).

      Or could be possible it is due to copying the realm object using:

      extension Object: DetachableObject {
        func detached() -> Self {
          let detached = type(of: self).init()
          for property in objectSchema.properties {
            guard let value = value(forKey: property.name) else {
              continue
            }
            if let detachable = value as? DetachableObject {
              detached.setValue(detachable.detached(), forKey: property.name)
            } else { // Then it is a primitive
              detached.setValue(value, forKey: property.name)
            }
          }
          return detached
        }
      }
      

      Version of Realm and Tooling

      ProductName: Mac OS X
      ProductVersion: 10.15.5
      BuildVersion: 19F101

      Xcode version: 11.5
      Build version: 11E608c

      Cocoapods version: 1.9.3

      Realm version: 5.0.2
      RealmSwift version: 5.0.2

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

              Created:
              Updated:
              Resolved: