Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-28942

Deadlock may occurs when releasing readers for SortMergeResultPartition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.16.0
    • 1.16.0
    • None

    Description

      After adding the logic of recycling buffers in CompositeBuffer in https://issues.apache.org/jira/browse/FLINK-28373, when reading data and recycling buffers simultaneously, the deadlock between the lock of SortMergeResultPartition and the lock of SingleInputGate may occur.

      In short, the deadlock may occur as follows.

      1. SingleInputGate.getNextBufferOrEvent (SingleInputGate lock)

      CompositeBuffer.getFullBufferData -> CompositeBuffer.recycleBuffer -> waiting for 

      SortMergeResultPartition lock;

      2. ResultPartitionManager.releasePartition (SortMergeResultPartition lock) -> 

      SortMergeSubpartitionReader.notifyDataAvailable -> 

      SingleInputGate.notifyChannelNonEmpty -> waiting for SingleInputGate lock.

      The possibility of this deadlock is very small, but we should fix the bug as soon as possible.

      Attachments

        Issue Links

          Activity

            People

              tanyuxin Yuxin Tan
              tanyuxin Yuxin Tan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: