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

Fix Race Condition when releasing shared memory resource

    XMLWordPrintableJSON

Details

    Description

      There is a race condition around releasing an OpaqueMemoryResource obtained via MemoryManager.getSharedMemoryResourceForManagedMemory.

      final boolean allDisposed = sharedResources.release(type, leaseHolder);
      if (allDisposed) {
      	releaseMemory(type, MemoryType.OFF_HEAP, size);
      }
      

      If another allocation occurs while the releasing thread is between the "sharedResources.release"and the "if block", then there is no resource to pick up any more and memory has not yet been returned to the memory bookkeeping.

      Attachments

        Issue Links

          Activity

            People

              sewen Stephan Ewen
              sewen Stephan Ewen
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m