[ 
https://issues.apache.org/jira/browse/FLINK-15905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephan Ewen updated FLINK-15905:
---------------------------------
    Description: 
There is a race condition around releasing an {{OpaqueMemoryResource}} obtained 
via {{MemoryManager.getSharedMemoryResourceForManagedMemory}}.

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

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.
Looks like a legitimate bug.

  was:
There is a race condition around releasing the memory in MemoryManager.

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.
Looks like a legitimate bug.


> Fix Race Condition when releasing shared memory resource
> --------------------------------------------------------
>
>                 Key: FLINK-15905
>                 URL: https://issues.apache.org/jira/browse/FLINK-15905
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Task
>            Reporter: Stephan Ewen
>            Priority: Critical
>             Fix For: 1.10.0
>
>
> There is a race condition around releasing an {{OpaqueMemoryResource}} 
> obtained via {{MemoryManager.getSharedMemoryResourceForManagedMemory}}.
> {code}
> final boolean allDisposed = sharedResources.release(type, leaseHolder);
> if (allDisposed) {
>       releaseMemory(type, MemoryType.OFF_HEAP, size);
> }
> {code}
> 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.
> Looks like a legitimate bug.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to