You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yu Li (Jira)" <ji...@apache.org> on 2020/02/06 05:07:00 UTC

[jira] [Comment Edited] (FLINK-15919) MemoryManager shouldn't allow releasing more memory than reserved

    [ https://issues.apache.org/jira/browse/FLINK-15919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17031281#comment-17031281 ] 

Yu Li edited comment on FLINK-15919 at 2/6/20 5:06 AM:
-------------------------------------------------------

bq. Are we already aware of any problem that a memory consumer may release more than reserved / allocated?
None from me.

Some background: the test mentioned in description was motivated by the [discussion|https://github.com/apache/flink/pull/11018#pullrequestreview-353658300] during PR review of FLINK-15905, where we depend on the guard in {{MemoryManager}} to make sure *_later_* changes won't cause "double release" of the memory accounting.


was (Author: carp84):
bq. Are we already aware of any problem that a memory consumer may release more than reserved / allocated?
None from me.

Some background: the test mentioned in description was motivated by the [discussion|https://github.com/apache/flink/pull/11018#pullrequestreview-353658300] during PR review of FLINK-15905, where we depend on the guard in {{MemoryManager}} to make sure later changes won't cause "double release" of the memory accounting.

> MemoryManager shouldn't allow releasing more memory than reserved
> -----------------------------------------------------------------
>
>                 Key: FLINK-15919
>                 URL: https://issues.apache.org/jira/browse/FLINK-15919
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Task
>    Affects Versions: 1.10.0
>            Reporter: Yu Li
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 1.10.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently {{MemoryManager}} allows releasing more memory than reserved for the same owner object, which could be reproduced by adding below test case into {{MemoryManagerTest}}:
> {code}
> 	@Test
> 	public void testMemoryReleaseGuard() throws MemoryReservationException {
> 		Object owner = new Object();
> 		Object owner2 = new Object();
> 		long totalHeapMemorySize = memoryManager.availableMemory(MemoryType.HEAP);
> 		memoryManager.reserveMemory(owner, MemoryType.HEAP, PAGE_SIZE);
> 		memoryManager.reserveMemory(owner2, MemoryType.HEAP, PAGE_SIZE);
> 		memoryManager.releaseMemory(owner, MemoryType.HEAP, PAGE_SIZE);
> 		memoryManager.releaseMemory(owner, MemoryType.HEAP, PAGE_SIZE);
> 		long heapMemoryLeft = memoryManager.availableMemory(MemoryType.HEAP);
> 		assertEquals("Memory leak happens", totalHeapMemorySize - PAGE_SIZE, heapMemoryLeft);
> 		memoryManager.releaseAllMemory(owner2, MemoryType.HEAP);
> 	}
> {code}



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