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

mongorestore hang while replaying last oplog failed in archive mode

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: