Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2403

mongorestore hang while replaying last oplog failed in archive mode

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 100.0.0
    • Affects Version/s: 4.2.1, 4.0.13
    • Component/s: mongorestore
    • Labels:
      None
    • v4.2

      In mongorestore archive mode with --oplogReplay option, mongorestore will hang while replaying last oplog in the archive failed. There are two goroutine stacks at the RegularCollectionReceiver.Close() func. The root cause is that the demux goroutine has readed out the archive, calling RegularCollectionReceiver.Close(), waiting on the notify of receiver.readBufChan. While the restore goroutine encounters an error while replaying oplog, also calling RegularCollectionReceiver.Close(), but waiting on the mutex of receiver.closeOnce.Do(), performing a deadlock. I have uploaded a simple patch to fix this bug, by forcing the restore goroutine read once more after error occurs. This will result in the close of the receiver.readBufChan, so that the demux goroutine can exit.

        1. hang.patch
          0.9 kB
          CenZheng

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            zhcn381 CenZheng
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: