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

Multi-process synchronization on Windows broken when one process exits or crashes

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

      Currently our Multi-process synchronization on Windows is broken when one of the processes exits or crashes. My investigation shows the first process releases the semaphore here
      https://github.com/realm/realm-core/blob/dfd5baae3c2d1a6745bcf3a186fa5ba2f3069840/src/realm/util/interprocess_condvar.cpp#L484
      and goes and waits for WaitForSingleObject(m_waiters_done which will be signaled only if both processes are able to complete the logic in
      https://github.com/realm/realm-core/blob/dfd5baae3c2d1a6745bcf3a186fa5ba2f3069840/src/realm/util/interprocess_condvar.cpp#L310-L315

      which if the second process has crashed or exited will never happen.

      This leaves the first process hanging on the WaitForSingleObject(m_waiters_done indefinitely

      This is pretty reproducible in Electron when if the user closes the window it actually closes the renderer process responsible for that window and the main process of the application is left hanging.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            lubo.blagoev@mongodb.com Lubo Blagoev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: