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

Failed to parse, or apply received changeset: ArrayInsert: Invalid prior_size

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None

      How frequently does the bug occur?

      Sometimes

      Description

      Cloned from here https://www.mongodb.com/community/forums/t/e-realm-sync-connection-1-session-1-failed-to-parse-or-apply-received-changeset/107809/4?u=anton_p

      Both iOS and Android apps are unable to open Realm for some users because of the error received from the Realm Sync.

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      Connection[1]: Session[1]: Failed to parse, or apply received changeset: ArrayInsert: Invalid prior_size (list size = 3, prior_size = 0) (instruction target: SettingsV2RealmModel[ObjectId{6159ef49872d4b24322a1daa}].ts[0], version: 47, last_integrated_remote_version: 1, origin_file_ident: 211, timestamp: 220174678003)
      Exception backtrace:
      0   Divtracker                          0x000000010b690676 _ZN5realm4sync17BadChangesetErrorCI1NS_4util22ExceptionWithBacktraceISt13runtime_errorEEIJNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEEEDpOT_ + 38
      1   Divtracker                          0x000000010b68ac92 _ZN5realm4sync12_GLOBAL__N_125throw_bad_transaction_logENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 34
      2   Divtracker                          0x000000010b68aa9f _ZNK5realm4sync18InstructionApplier19bad_transaction_logERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 1135
      3   Divtracker                          0x000000010b698999 _ZNK5realm4sync18InstructionApplier19bad_transaction_logIJmRKjEEEvPKcDpOT_ + 73
      4   Divtracker                          0x000000010b698477 _ZN5realm4sync18InstructionApplier20resolve_list_elementINS_4util8overloadIJZNS1_clERKNS0_5instr11ArrayInsertEE4$_20ZNS1_clES8_E4$_21ZNS1_clES8_E4$_22ZNS1_clES8_E4$_23ZNS1_clES8_E4$_24ZNS1_clES8_E4$_25EEEEEvRNS_7LstBaseEmNSt3__111__wrap_iterIPKN5mpark7variantIJNS0_12InternStringEjEEEEESQ_PKcOT_ + 2871
      5   Divtracker                          0x000000010b697439 _ZN5realm4sync18InstructionApplier13resolve_fieldINS_4util8overloadIJZNS1_clERKNS0_5instr11ArrayInsertEE4$_20ZNS1_clES8_E4$_21ZNS1_clES8_E4$_22ZNS1_clES8_E4$_23ZNS1_clES8_E4$_24ZNS1_clES8_E4$_25EEEEEvRNS_3ObjENS0_12InternStringENSt3__111__wrap_iterIPKN5mpark7variantIJSI_jEEEEESQ_PKcOT_ + 1177
      6   Divtracker                          0x000000010b68ea2c _ZN5realm4sync18InstructionApplierclERKNS0_5instr11ArrayInsertE + 636
      7   Divtracker                          0x000000010b6b16f4 _ZN5realm4sync18InstructionApplier5applyIS1_EEvRT_RKNS0_9ChangesetEPNS_4util6LoggerE + 100
      8   Divtracker                          0x000000010b6ae662 _ZN5realm5_impl17ClientHistoryImpl27integrate_server_changesetsERKNS_4sync12SyncProgressEPKyPKNS2_11Transformer15RemoteChangesetEmRNS2_11VersionInfoERNS2_21ClientReplicationBase16IntegrationErrorERNS_4util6LoggerEPNSE_20SyncTransactReporterE + 946
      9   Divtracker                          0x000000010b6bff0d _ZN5realm5_impl14ClientImplBase7Session29initiate_integrate_changesetsEyRKNSt3__16vectorINS_4sync11Transformer15RemoteChangesetENS3_9allocatorIS7_EEEE + 173
      10  Divtracker                          0x000000010b68572a _ZN12_GLOBAL__N_111SessionImpl29initiate_integrate_changesetsEyRKNSt3__16vectorIN5realm4sync11Transformer15RemoteChangesetENS1_9allocatorIS6_EEEE + 42
      11  Divtracker                          0x000000010b6be9bd _ZN5realm5_impl14ClientImplBase7Session24receive_download_messageERKNS_4sync12SyncProgressEyRKNSt3__16vectorINS3_11Transformer15RemoteChangesetENS7_9allocatorISA_EEEE + 589
      12  Divtracker                          0x000000010b6bc15d _ZN5realm5_impl14ClientProtocol22parse_message_receivedINS0_14ClientImplBase10ConnectionEEEvRT_PKcm + 5485
      13  Divtracker                          0x000000010b6b6bd4 _ZN5realm5_impl14ClientImplBase10Connection33websocket_binary_message_receivedEPKcm + 52
      14  Divtracker                          0x000000010b64ce25 _ZN12_GLOBAL__N_19WebSocket17frame_reader_loopEv + 1509
      15  Divtracker                          0x000000010b6c39a0 _ZN5realm4util7network7Service9AsyncOper22do_recycle_and_executeINSt3__18functionIFvNS5_10error_codeEmEEEJRS7_RmEEEvbRT_DpOT0_ + 224
      16  Divtracker                          0x000000010b6c3464 _ZN5realm4util7network7Service14BasicStreamOpsINS1_3ssl6StreamEE16BufferedReadOperINSt3__18functionIFvNS8_10error_codeEmEEEE19recycle_and_executeEv + 196
      17  Divtracker                          0x000000010b6f4784 _ZN5realm4util7network7Service4Impl3runEv + 484
      18  Divtracker                          0x000000010b67cb5d _ZN5realm4sync6Client3runEv + 29
      19  Divtracker                          0x000000010b822e8d _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl10SyncClientC1ENS2_INS7_4util6LoggerENS4_ISB_EEEERKNS7_16SyncClientConfigENS_8weak_ptrIKNS7_11SyncManagerEEEEUlvE0_EEEEEPvSN_ + 45
      20  libsystem_pthread.dylib             0x00007fff6bfee8fc _pthread_start + 224
      21  libsystem_pthread.dylib             0x00007fff6bfea443 thread_start + 15
      

      I also have a full log from the device but can’t list it here as it may contain some personal info like tokens/URLs/IDs/etc. Please reach me if that may help in the investigation.

      Can you reproduce the bug?

      Yes, always

      Reproduction Steps

      I do not know the exact steps to reproduce. We have the SettingsV2RealmModel model that contains a list of embedded objects. After we deployed this new model and performed data migration from the old V1 format we received several reports from our users that they are unable to start the app. Erasing databases or the whole Realm folder on the client-side didn’t work. I tried to install the fresh app and log in as a user with the problem and I faced the same issue.

      We had to terminate sync and start it again. After that, I was able to log in as a previously broken user. Sync termination is a terrible user experience and we don’t have a clean way to perform that on our mobile clients so we can’t do that all the time. Please-please-please fix the issue on your side.

      SettingsV2RealmModel scheme:

      {
        "properties": {
          "_id": {
            "bsonType": "objectId"
          },
          "_p": {
            "bsonType": "string"
          },
          "ce": {
            "bsonType": "bool"
          },
          "g": {
            "bsonType": "int"
          },
          "t": {
            "bsonType": "double"
          },
          "te": {
            "bsonType": "bool"
          },
          "ts": {
            "bsonType": "array",
            "items": {
              "bsonType": "object",
              "properties": {
                "s": {
                  "bsonType": "objectId"
                },
                "t": {
                  "bsonType": "double"
                }
              },
              "required": [
                "s",
                "t"
              ],
              "title": "TaxesV2RealmModel"
            }
          }
        },
        "required": [
          "_id",
          "_p"
        ],
        "title": "SettingsV2RealmModel"
      }
      

      Version

      10.14.0

      What SDK flavour are you using?

      MongoDB Realm (i.e. Sync, auth, functions)

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      iOS 15.0

      Build environment

      ProductName:	macOS
      ProductVersion:	11.6
      BuildVersion:	20G165
      
      /Applications/Xcode.app/Contents/Developer
      Xcode 13.1
      Build version 13A1030d
      
      /usr/local/bin/pod
      1.11.2
      Realm (10.14.0)
      RealmSwift (10.14.0)
      RealmSwift (= 10.14.0)
      
      /bin/bash
      GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
      
      /usr/local/bin/carthage
      0.38.0
      (not in use here)
      
      /usr/bin/git
      git version 2.30.1 (Apple Git-130)
      

            Assignee:
            mikeo@mongodb.com Michael O'Brien
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: