Race in oplog acquisition at startup

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • ALL
    • Repl 2024-03-18
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      During ReplicationCoordinatorImpl startup, we initialize the LocalOplogInfo oplog collection by calling acquireOplogForLogging

      https://github.com/mongodb/mongo/blame/b70be78ecfe773a1c9b5685b4af9cd25ea214eb5/src/mongo/db/repl/oplog.cpp#L2548

      This acquires an IX lock on the oplog collection, and oplogInfo itself is not protected at all. Thus a simultaneous call which reads the oplogInfo pointer with only an IS global lock can cause a data race.

      Possibly we should acquire global X here, as the catalog code does when it uses the similar establishOplogForLogging().

              Assignee:
              Matthew Russotto
              Reporter:
              Matthew Russotto
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: