Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9349

Race condition when fsyncLocking and unlocking can cause the shell to hang on all attempts to unlock

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.2.4, 2.4.1
    • Fix Version/s: None
    • Component/s: Concurrency
    • Labels:
      None
    • Operating System:
      ALL

      Description

      When locking and unlocking from the shell a large number of times, a state can be reached where the shell will hang for every db.fsyncUnlock(). This causes the a situation where the user is unable to unlock.

      For example, the following oneliner will eventually cause the shell to hang:

      for(x=0;x<100;x++){print(x);printjson(db.fsyncLock());printjson(db.fsyncLock());printjson(db.fsyncUnlock());printjson(db.fsyncUnlock());}

      Appears to happen where multiple fsyncLock calls are made (rather than a corresponding fsyncUnlock for every fsyncLock. Anecdotally appears to happen when the locks count would be "zero" (all locks finished), after locking and unlocking several times.

      Once the shell hangs once, no db.fsyncUnlock() will succeed - they will all cause the shell to hang, and nothing untoward will be printed in the logs (even at verbosity 5)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              andre.defrere Andre de Frere
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: