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

Deadlock during canceling task and recycling exclusive buffer

    XMLWordPrintableJSON

Details

    Description

      It may cause deadlock between task canceler thread and task thread.

      The detail is as follows:

      Task canceler thread -> IC1#releaseAllResources -> recycle floating buffers -> lock(LocalBufferPool#availableMemorySegments) -> IC2#notifyBufferAvailable > try to lock(IC2#bufferQueue)

      Task thread -> IC2#recycle -> lock(IC2#bufferQueue) -> bufferQueue#addExclusiveBuffer -> floatingBuffer#recycleBuffer -> try to lock(LocalBufferPool#availableMemorySegments)

      One solution is that listener#notifyBufferAvailable can be called outside the synchronized(availableMemorySegments) in LocalBufferPool#recycle.

      The existing RemoteInputChannelTest#testConcurrentOnSenderBacklogAndRecycle can cover this case but the deadlock probability is very low, so this UT is not stable.

      Attachments

        Activity

          People

            nkruber Nico Kruber
            zjwang Zhijiang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: