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

Invalid prior_size (list size = 0, prior_size = 1)

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Sync

      Fairly simple repro case. Here is the schema:

       

      class SimplePrimaryKeyObject2: Object {
          @Persisted(primaryKey: true) var _id: Int = 0
          @Persisted var oid = ObjectId.generate()
          @Persisted var lstInt = List<Int>()
          @Persisted var lstOid = List<ObjectId>()
          @Persisted var lstLnk = List<SimplePrimaryKeyObject>()
      }
       
      class SimplePrimaryKeyObject: Object {
          @Persisted(primaryKey: true) var _id: String? = ""
          @Persisted var oid = ObjectId.generate()
          @Persisted var lstInt = List<Int>()
          @Persisted var lstOid = List<ObjectId>()
          @Persisted var lstLnk: SimplePrimaryKeyObject?
      }
      

      The repro code is fairly straightforward:

       

      let realm = ObjectiveCSupport.convert(object: try! RLMRealm(configuration: realm.configuration))
                              realm.beginWrite()
                              let key: String? = ""
       
                              switch RealmAction.allCases.randomElement()! {
                              case .add:
                                  let spko = SimplePrimaryKeyObject()
                                  let spko2 = SimplePrimaryKeyObject2()
                                  realm.add(spko, update: .all)
                                  realm.add(spko2, update: .all)
                              case .remove:
                                  if let object = realm.object(ofType: SimplePrimaryKeyObject.self,
                                                               forPrimaryKey: key) {
                                      realm.delete(object)
                                  }
                              case .modify:
                                  if let object = realm.object(ofType: SimplePrimaryKeyObject.self,
                                                               forPrimaryKey: key) {
                                      realm.object(ofType: SimplePrimaryKeyObject2.self,
                                                   forPrimaryKey: 0)?.lstInt.append(Int.random(in: Int.min...Int.max))
                                  }
                              case .read: break
                              }
                              try! realm.commitWrite()
      

      Spawning a bunch of threads, 3 users will randomly add, delete, or modify/add to the list property on SimplePrimaryKeyObject2. The test can repro the error with both lists of links or primitives.

       

      Attaching client logs, server logs, and db dump. cc tyler.kaye@mongodb.com mikeo@mongodb.com 

       

       

        1. __realm_sync.zip
          3.33 MB
        2. client_logs.txt
          13.12 MB
        3. server_logs.txt
          480 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            jason.flax@mongodb.com Jason Flax
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: