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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.4, 2.4.1
    • Component/s: Concurrency
    • Labels:
      None
    • ALL

      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)

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

              Created:
              Updated:
              Resolved: