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

Deadlock among RecoverRefreshThread, index build, step down, and prepared transaction

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sharding EMEA
    • Fully Compatible
    • ALL
    • Sharding EMEA 2023-02-06
    • 124

      A prepared transaction holds an IX lock on its collection. An index build is about to run its second drain phase and enqueues a collection S lock (behind the prepared transaction) after explicitly unlocking the RSTL. The RecoverRefreshThread runs, taking the RSTL in IX and (uninterruptiblty) enqueuing a collection IX lock. (Since the previously enqueued index build collection lock is mode S, this IX lock will queue behind it despite the lock granted to the prepared transaction also being IX.) Then a step down occurs, enqueueing the RSTL in X mode behind RecoverRefreshThread. The RecoverRefreshThread is explicitly marked as being killable by step down, but the lock acquisition is uninterruptible. Thus a four-way deadlock has been reached.

            Assignee:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Reporter:
            gregory.noma@mongodb.com Gregory Noma
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: