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

Exception with ArrayMove instruction on list of links with dangling links

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

      Our fuzz tests are triggering an exception in the realm apply-to-state tool that is related to ArrayMove instructions on lists of links with dangling links

      Here's the output:

      [ 04:28 PM kmorkos@W-R911G4K3: ~/dev/baas2/realm/fuzz (master) ]
      > realm-apply-to-state -r fuzz_test_tmp/cppApplier_default_schema_default_operations_10_writes428493977/changesets -i fuzz_test_tmp/cppApplier_default_schema_default_operations_10_writes428493977/messages_62a237d0b13eb9e92fb31b11.txt --verbose
      found upload changeset: 0 0 1 1 240
      Decoded changeset: InternStrings   0="hq", 1="pd", 2="va", 3="_id", 4="vu", 5="vv", 6="ye", 7="ah", 8="oy", 9="hc", 10="yq", 11="fq", 12="mk", 13="qt", 14="ws", 15="eb", 16="qi", 17="in", 18="xk", 19="ed", 20="eg", 21="kw", 22="ux"
      AddTable        path="hq", embedded=1
      AddTable        path="pd", embedded=1
      AddTable        path="va", pk_field="_id", pk_type=ObjectId, pk_nullable=0
      AddTable        path="vu", embedded=1
      AddTable        path="vv", embedded=1
      AddTable        path="ye", embedded=1
      AddColumn       table="hq", field="ah", type=String, nullable=0, collection_type=Set
      AddColumn       table="hq", field="oy", type=Link, nullable=1, collection_type=Single, target_table="pd"
      AddColumn       table="pd", field="hc", type=Link, nullable=0, collection_type=List, target_table="vu"
      AddColumn       table="pd", field="yq", type=Null, nullable=1, collection_type=Single
      AddColumn       table="va", field="fq", type=Link, nullable=0, collection_type=List, target_table="va"
      AddColumn       table="va", field="mk", type=Link, nullable=1, collection_type=Single, target_table="vv"
      AddColumn       table="va", field="qt", type=Link, nullable=1, collection_type=Single, target_table="va"
      AddColumn       table="va", field="ws", type=Timestamp, nullable=0, collection_type=List
      AddColumn       table="vu", field="eb", type=Link, nullable=0, collection_type=List, target_table="ye"
      AddColumn       table="vu", field="qi", type=Binary, nullable=1, collection_type=Single
      AddColumn       table="vv", field="in", type=Link, nullable=1, collection_type=Single, target_table="hq"
      AddColumn       table="vv", field="xk", type=Float, nullable=0, collection_type=List
      AddColumn       table="ye", field="ed", type=Bool, nullable=1, collection_type=Single
      AddColumn       table="ye", field="eg", type=String, nullable=0, collection_type=Single
      AddColumn       table="ye", field="kw", type=Null, nullable=1, collection_type=List
      AddColumn       table="ye", field="ux", type=Binary, nullable=0, collection_type=Single
      
      found upload changeset: 1 1 1 1 306
      Decoded changeset: InternStrings   0="va", 1="fq", 2="mk", 3="in", 4="ah", 5="qt", 6="ws"
      CreateObject    path=va[ObjectId\{1079301076e9296046eff8e9}]
      Clear           path=va[ObjectId\{1079301076e9296046eff8e9}].fq
      ArrayInsert     path=va[ObjectId\{1079301076e9296046eff8e9}].fq[0], value=Link(target_table = va, target = ObjectId\{1079301076e9296046eff8e9}), prior_size=0
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].mk, value=Null(), default=0
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].mk, value=ObjectValue(), default=0
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].mk.in, value=Null(), default=0
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].mk.in, value=ObjectValue(), default=0
      Clear           path=va[ObjectId\{1079301076e9296046eff8e9}].mk.in.ah
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].qt, value=Link(target_table = va, target = ObjectId\{1079301076e9296046eff8e9}), default=0
      Clear           path=va[ObjectId\{1079301076e9296046eff8e9}].fq
      Update          path=va[ObjectId\{1079301076e9296046eff8e9}].qt, value=Link(target_table = va, target = ObjectId\{1079301076e9296046eff8e9}), default=0
      Clear           path=va[ObjectId\{1079301076e9296046eff8e9}].ws
      
      found upload changeset: 2 2 1 1 214
      Decoded changeset: InternStrings   0="va", 1="fq"
      CreateObject    path=va[ObjectId\{1e81483eccab25ca653bf0e4}]
      Clear           path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq
      ArrayInsert     path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq[0], value=Link(target_table = va, target = ObjectId\{1079301076e9296046eff8e9}), prior_size=0
      ArrayInsert     path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq[1], value=Link(target_table = va, target = ObjectId\{1079301076e9296046eff8e9}), prior_size=1
      ArrayInsert     path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq[2], value=Link(target_table = va, target = ObjectId\{1e81483eccab25ca653bf0e4}), prior_size=2
      ArrayInsert     path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq[3], value=Link(target_table = va, target = ObjectId\{1e81483eccab25ca653bf0e4}), prior_size=3
      EraseObject     path=va[ObjectId\{1079301076e9296046eff8e9}]
      ArrayMove       path=va[ObjectId\{1e81483eccab25ca653bf0e4}].fq[2], ndx_2=0, prior_size=4
      
      group.get_or_add_table_with_primary_key(group, "class_va", type_ObjectId, "_id", false);
      integrated local changesets as version 8
      sync::create_object_with_primary_key(group, get_table("class_va"), 1079301076e9296046eff8e9);
      integrated local changesets as version 9
      sync::create_object_with_primary_key(group, get_table("class_va"), 1e81483eccab25ca653bf0e4);
      ../src/realm/impl/transact_log.hpp:721: [realm-core-11.17.0] Assertion failed: from_link_ndx != to_link_ndx
      realm-apply-to-state() [0x74f377]
      realm-apply-to-state() [0x74f57d]
      realm-apply-to-state() [0x4be17f]
      realm-apply-to-state() [0x4be873]
      realm-apply-to-state() [0x4bb800]
      realm-apply-to-state() [0x600550]
      realm-apply-to-state() [0x49f464]
      realm-apply-to-state() [0x4a3321]
      realm-apply-to-state() [0x4a2a63]
      realm-apply-to-state() [0x4a2569]
      realm-apply-to-state() [0x49f4a6]
      realm-apply-to-state() [0x418cf4]
      realm-apply-to-state() [0x418ec0]
      realm-apply-to-state() [0x415761]
      realm-apply-to-state() [0x40cbfa]
      realm-apply-to-state() [0x40fdf0]
      realm-apply-to-state() [0x4100f6]
      realm-apply-to-state() [0x40fe2f]
      realm-apply-to-state() [0x40fe72]
      realm-apply-to-state() [0x40febf]
      realm-apply-to-state() [0x410135]
      realm-apply-to-state() [0x40fefe]
      realm-apply-to-state() [0x40d0c3]
      realm-apply-to-state() [0x40d5c5]
      realm-apply-to-state() [0x40d614]
      realm-apply-to-state() [0x40d699]
      realm-apply-to-state() [0x40dc9b]
      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f2754bfc0b3]
      realm-apply-to-state() [0x40b5ae]!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
      Thread name: realm-apply-to-
      Aborted
      

      I've attached the messages file that causes this, as well as a json file that includes the schema. It's worth noting that if I remove the erase instruction that results in the dangling link, the ArrayMove is successful.

            Assignee:
            james.stone@mongodb.com James Stone
            Reporter:
            kiro.morkos@mongodb.com Kiro Morkos
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: