You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "SuYan (JIRA)" <ji...@apache.org> on 2016/06/02 08:30:59 UTC

[jira] [Commented] (SPARK-12757) Use reference counting to prevent blocks from being evicted during reads

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

SuYan commented on SPARK-12757:
-------------------------------

[~joshrosen]
Hi, can someone do some works to merge this patch and some-related patch merge into Spark 1.6.1, 

There is a dead-lock in Spark 1.6.1, 
Thread 1: CleanBroadCastBlock(Asked by Driver), first getting info.sync(BlockManager.removeBlock), second getting UnifiedMemoryManager.sync(memoryStore.removeBlock)
Thread 2: Task Thread, acquire memory from evictBlock, first getting UnifiedMemoryManager.sync, second getting info.sync(BlockManager.dropFromMemory)

but it seems fixed in Spark 2.0:
[SPARK-12757] Add block-level read/write locks to BlockManager
[SPARK-15300] Fix writer lock conflict when remove a block
[SPARK-13833] Guard against race condition when re-caching disk block…
[SPARK-13695] Don't cache MEMORY_AND_DISK blocks as bytes in memory a…

I not sure it is suitable to merge these patch into Spark1.6.1, or just create another temporary solution to emergent fix?


> Use reference counting to prevent blocks from being evicted during reads
> ------------------------------------------------------------------------
>
>                 Key: SPARK-12757
>                 URL: https://issues.apache.org/jira/browse/SPARK-12757
>             Project: Spark
>          Issue Type: Improvement
>          Components: Block Manager
>            Reporter: Josh Rosen
>            Assignee: Josh Rosen
>             Fix For: 2.0.0
>
>
> As a pre-requisite to off-heap caching of blocks, we need a mechanism to prevent pages / blocks from being evicted while they are being read. With on-heap objects, evicting a block while it is being read merely leads to memory-accounting problems (because we assume that an evicted block is a candidate for garbage-collection, which will not be true during a read), but with off-heap memory this will lead to either data corruption or segmentation faults.
> To address this, we should add a reference-counting mechanism to track which blocks/pages are being read in order to prevent them from being evicted prematurely. I propose to do this in two phases: first, add a safe, conservative approach in which all BlockManager.get*() calls implicitly increment the reference count of blocks and where tasks' references are automatically freed upon task completion. This will be correct but may have adverse performance impacts because it will prevent legitimate block evictions. In phase two, we should incrementally add release() calls in order to fix the eviction of unreferenced blocks. The latter change may need to touch many different components, which is why I propose to do it separately in order to make the changes easier to reason about and review.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org