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

ASF GitHub Bot updated SPARK-49133:
-----------------------------------
    Labels: pull-request-available  (was: )

> Make MemoryConsumer#used atomic to avoid deadlock
> -------------------------------------------------
>
>                 Key: SPARK-49133
>                 URL: https://issues.apache.org/jira/browse/SPARK-49133
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>    Affects Versions: 3.5.1
>            Reporter: Hongze Zhang
>            Priority: Major
>              Labels: pull-request-available
>
> MemoryConsumer doesn't provide internal thread-safety so user should add 
> their own locking scope when it's used in multi-threaded environment.
> Thinking of multiple threads are allocating memory in the same task (although 
> it's a special case regarding Spark's memory model), to protect the 
> thread-safety of MemoryConsumer, user has to lock the API invocations of it. 
> In this case, if one memory consumer spills another concurrently, there's a 
> risk of ABBA deadlock. E.g., consumer A locks itself to acquire memory from 
> task memory manager, while consumer B locks task memory manager then spills A.
> To fix this problem, Spark could ensure MemoryConsumer's thread-safety so 
> user doesn't have to add their own lock in most cases.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to