Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-6256

Deadlock when calling FLUSH

    XMLWordPrintableJSON

Details

    Description

      There is a deadlock issue which can be triggered by the FLUSH command in the following condition:

      1. The main thread constructs sub-threads of closing tsfiles.

      2. The last sub-thread is near its end and removes itself from ''closingSequenceTsFileProcessors''. Then the main thread breaks the while loop, holds ''closeStroageGroupCondition'', and uses ''future.get'' to wait for the sub-thread.

      3. Unfortunately, since the main thread holds the condition, the sub-thread cannot hold it and gets stuck. The main thread is also blocked by the sub-thread through "future.get", so there is a deadlock.

       

      The solution is simple: there is no need for the main thread to wait for the sub-threads while holding the condition, and the waiting can be done outside of the synchronization block.

      Attachments

        1. image-2023-11-23-19-30-31-905.png
          92 kB
          Tian Jiang
        2. image-2023-11-23-19-36-00-222.png
          154 kB
          Tian Jiang
        3. image-2023-11-23-19-36-36-198.png
          135 kB
          Tian Jiang
        4. image-2023-11-23-19-39-32-027.png
          150 kB
          Tian Jiang

        Issue Links

          Activity

            People

              jt2594838 Tian Jiang
              jt2594838 Tian Jiang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: