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:
    • 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.

            david.golden@mongodb.com David Golden
            zhcn381 CenZheng
            0 Vote for this issue
            4 Start watching this issue