-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Sync
-
3 - M (<= 1 month)
-
5405
-
Not Needed
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