Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-397

Error when listening changes from node js - Sync error?

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      I'm trying to launch this script but I have this error and I don't understand what's happening. Yesterday it worked well.

      Goals

      My goal is to listen at changes in my realms.

      Expected Results

      Nothing, just no error. If I insert a console.log in the change handler function, I will see some logs.

      Actual Results

      Some days ago it worked well. From this morning I have this error:

      /Users/realm/workspace/realm_realm-sync_master/realm-sync/src/realm/sync/instruction_applier.cpp:519: [realm-core-5.23.7] Assertion failed: instr.prior_size <= m_selected_link_list->size() with (instr.prior_size, m_selected_link_list->size()) =  [81, 80]
      0   realm.node                          0x0000000106772e7c _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
      1   realm.node                          0x00000001067733a2 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 466
      2   realm.node                          0x00000001063b7556 _ZN5realm4util19terminate_with_infoIJRKjmEEEvPKciS5_S5_DpOT_ + 70
      3   realm.node                          0x00000001063b74b0 _ZN5realm4sync18InstructionApplier3logIJRKjmEEEvPKcDpOT_ + 0
      4   realm.node                          0x000000010632ff4e _ZN5realm5_impl17ClientHistoryImpl27integrate_server_changesetsERKNS_4sync12SyncProgressEPKyPKNS2_11Transformer15RemoteChangesetEmRNS2_11VersionInfoERNS2_17ClientHistoryBase16IntegrationErrorERNS_4util6LoggerEPNSE_20SyncTransactReporterEPKNS2_27SerialTransactSubstitutionsE + 1518
      5   realm.node                          0x000000010636add2 _ZN5realm5_impl14ClientImplBase7Session20integrate_changesetsERNS_4sync17ClientHistoryBaseERKNS3_12SyncProgressEyRKNSt3__16vectorINS3_11Transformer15RemoteChangesetENS9_9allocatorISC_EEEERNS3_11VersionInfoERNS4_16IntegrationErrorE + 114
      6   realm.node                          0x000000010636b587 _ZN5realm5_impl14ClientImplBase7Session29initiate_integrate_changesetsEyRKNSt3__16vectorINS_4sync11Transformer15RemoteChangesetENS3_9allocatorIS7_EEEE + 103
      7   realm.node                          0x00000001063ac66a _ZN12_GLOBAL__N_111SessionImpl29initiate_integrate_changesetsEyRKNSt3__16vectorIN5realm4sync11Transformer15RemoteChangesetENS1_9allocatorIS6_EEEE + 42
      8   realm.node                          0x00000001063695ec _ZN5realm5_impl14ClientImplBase7Session24receive_download_messageERKNS_4sync12SyncProgressEyRKNSt3__16vectorINS3_11Transformer15RemoteChangesetENS7_9allocatorISA_EEEE + 636
      9   realm.node                          0x000000010636602f _ZN5realm5_impl14ClientProtocol22parse_message_receivedINS0_14ClientImplBase10ConnectionEEEvRT_PKcm + 7903
      10  realm.node                          0x000000010635ffb4 _ZN5realm5_impl14ClientImplBase10Connection33websocket_binary_message_receivedEPKcm + 52
      11  realm.node                          0x0000000106391ac0 _ZN12_GLOBAL__N_19WebSocket17frame_reader_loopEv + 2416
      12  realm.node                          0x000000010636fac3 _ZN5realm4util7network7Service9AsyncOper29do_recycle_and_execute_helperINSt3__18functionIFvNS5_10error_codeEmEEEJS7_mEEEvbRbT_DpT0_ + 163
      13  realm.node                          0x000000010636f8f7 _ZN5realm4util7network7Service9AsyncOper22do_recycle_and_executeINSt3__18functionIFvNS5_10error_codeEmEEEJRS7_RmEEEvbRT_DpOT0_ + 135
      14  realm.node                          0x000000010636f404 _ZN5realm4util7network7Service14BasicStreamOpsINS1_3ssl6StreamEE16BufferedReadOperINSt3__18functionIFvNS8_10error_codeEmEEEE19recycle_and_executeEv + 212
      15  realm.node                          0x0000000106381a7c _ZN5realm4util7network7Service4Impl3runEv + 476
      16  realm.node                          0x000000010639efed _ZN5realm4sync6Client3runEv + 29
      17  realm.node                          0x00000001063174d7 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl10SyncClientC1ENS2_INS7_4util6LoggerENS4_ISB_EEEENS7_4sync6Client13ReconnectModeEbRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEUlvE_EEEEEPvSR_ + 42
      18  libsystem_pthread.dylib             0x00007fff68d1bd36 _pthread_start + 125
      19  libsystem_pthread.dylib             0x00007fff68d1858f thread_start + 15!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to help@realm.io.Abort trap: 6
      
      

      Steps to Reproduce

      Just npm install and node index.js

      Code Sample

      'use strict';
      
      var Realm = require('realm'); 
      
      // the URL to the Realm Object Server
      const SERVER_URL = '*****';
      var REALM_URL = '******';
      
      // The regular expression you provide restricts the observed Realm files to only the subset you
      // are actually interested in. This is done in a separate step to avoid the cost
      // of computing the fine-grained change set if it's not necessary.
      var NOTIFIER_PATH = '.*';
      
      //declare admin user 
      let adminUser = undefined
      let global_realm = undefined
      
      
      // The handleChange callback is called for every observed Realm file whenever it
      // has changes. It is called with a change event which contains the path, the Realm,
      // a version of the Realm from before the change, and indexes indication all objects
      // which were added, deleted, or modified in this change
      var handleChange = async function (changeEvent) {
        // Extract the user ID from the virtual path, assuming that we're using
        // a filter which only subscribes us to updates of user-scoped Realms.
      
      
      }
      
      // register the event handler callback
      async function main() {
          const credentials = Realm.Sync.Credentials.usernamePassword("******", "*****")
          adminUser = await Realm.Sync.User.login(SERVER_URL, credentials)
          Realm.open(adminUser.createConfiguration({
            sync: {
                url: '/fullSyncApp3',
                fullSynchronization: true
            }
          }))
          .progress((transferred, transferable) => {
              console.log(transferred, transferable)
          })
          .then(realm => {
              // use the Realm
              global_realm = realm
      
              console.log("Global Realm", global_realm.objects("GlobalSettings").length)
              Realm.Sync.addListener(REALM_URL, adminUser, NOTIFIER_PATH, 'change', handleChange);
          })
      
         
      }
      
      main()
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 3.6.0
      • Node or React Native: Node
      • Client OS & Version: Mac OS 10.15.1
      • Which debugger for React Native: None

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: