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

Crash in SyncManager::unregister_session

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

      SDK and version

      SDK : .NET
      Version: 10.15.1
      Core: 12.5.0

      Observations

      • How frequent do the crash occur?
        • Rarely
      • Does it happen in production or during dev/test?
        • dev/test
      • Can the crash be reproduced by you?
        • Occasionally
      • Can you provide instructions for how we can reproduce it?
        • No, there's no consistent pattern

      Crash log / stacktrace

      #0  0x000001a83a27cc in pthread_mutex_lock
      #1  0xdb348001a82f91a8 in std::__1::mutex::lock()
      #2  0x75630002f014a9c0 in realm::SyncManager::unregister_session(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
      #3  0x000002f01586a0 in std::__1::__shared_ptr_emplace<realm::SyncSession::ExternalReference, std::__1::allocator<realm::SyncSession::ExternalReference> >::__on_zero_shared()
      #4  0x000002f0048730 in realm_syncsession_destroy
      #5  0x000002fb03adac in  (wrapper managed-to-native) Realms.Sync.SessionHandle/NativeMethods:destroy (intptr) [{0x2f5156460} + 0x6c]  (0x2fb03ad40 0x2fb03ae0c) [0x130f02a80 - Unity Child Domain]
      #6  0x000002fb03ab10 in  Realms.Sync.SessionHandle:Unbind () [{0x2f57e4988} + 0x20]  (0x2fb03aaf0 0x2fb03ab20) [0x130f02a80 - Unity Child Domain]
      #7  0x000002fb03a990 in  Realms.SharedRealmHandle:UnbindLockedList () [{0x2b221bf00} + 0x68]  (0x2fb03a928 0x2fb03aa20) [0x130f02a80 - Unity Child Domain]
      #8  0x000002fb03a4c4 in  Realms.SharedRealmHandle:ReleaseHandle () [{0x2e6c681a0} + 0xa4]  (0x2fb03a420 0x2fb03a5ec) [0x130f02a80 - Unity Child Domain]
      #9  0x000002f9662108 in  System.Runtime.InteropServices.SafeHandle:DangerousReleaseInternal (bool) [{0x14238f6f8} + 0x218]  (0x2f9661ef0 0x2f9662128) [0x130f02a80 - Unity Child Domain]
      #10 0x000002faf5c4c4 in  System.Runtime.InteropServices.SafeHandle:InternalFinalize () [{0x141cad768} + 0x24]  (0x2faf5c4a0 0x2faf5c4d4) [0x130f02a80 - Unity Child Domain]
      #11 0x000002faeb7bf0 in  System.Runtime.InteropServices.SafeHandle:Dispose (bool) [{0x14238ea38} + 0x30]  (0x2faeb7bc0 0x2faeb7c00) [0x130f02a80 - Unity Child Domain]
      #12 0x000002faf5c434 in  System.Runtime.InteropServices.SafeHandle:Finalize () [{0x14238e9c0} + 0x24]  (0x2faf5c410 0x2faf5c46c) [0x130f02a80 - Unity Child Domain]
      #13 0x000002f9739704 in  (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) [{0x141959e98} + 0x74]  (0x2f9739690 0x2f97397a4) [0x130f02a80 - Unity Child Domain]
      #14 0x00000135a74728 in mono_gc_run_finalize
      #15 0x00000135a763d4 in finalizer_thread
      #16 0x00000135a3d570 in start_wrapper_internal
      #17 0x00000135a3d41c in start_wrapper
      #18 0x00000135abccb0 in GC_inner_start_routine
      #19 0x00000135abcc38 in GC_start_routine
      #20 0x000001a83a826c in _pthread_start
      

      Steps & Code to Reproduce

      Happens in Unity when I reload the assembly. This causes the finalizer to collect all C# instances, which in turn release any shared pointers they were holding. Based on the stacktrace, when destroying a sync session, it tries to unregister from the manager and a mutex fails to lock. I don't know what the reason for that could be, but I figured someone on the Core team might.

            Assignee:
            daniel.tabacaru@mongodb.com Daniel Tabacaru
            Reporter:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: