mridulm commented on code in PR #45052:
URL: https://github.com/apache/spark/pull/45052#discussion_r1501765989


##########
core/src/main/scala/org/apache/spark/storage/BlockManager.scala:
##########
@@ -177,15 +177,17 @@ private[spark] class HostLocalDirManager(
  * Manager running on every node (driver and executors) which provides 
interfaces for putting and
  * retrieving blocks both locally and remotely into various stores (memory, 
disk, and off-heap).
  *
- * Note that [[initialize()]] must be called before the BlockManager is usable.
+ * Note that [[initialize()]] must be called before the BlockManager is 
usable. Also, the
+ * `memoryManager` is initialized at a later stage after DriverPlugin is 
loaded, to allow the
+ * plugin to overwrite memory configurations.
  */
 private[spark] class BlockManager(
     val executorId: String,
     rpcEnv: RpcEnv,
     val master: BlockManagerMaster,
     val serializerManager: SerializerManager,
     val conf: SparkConf,
-    memoryManager: MemoryManager,
+    var memoryManager: MemoryManager,

Review Comment:
   @sunchao Can you please take a look [at 
this](https://github.com/apache/spark/compare/master...mridulm:spark:45052-suggestion-for-sunchao)
 ?
   It should fix the issue we are discussing - the test is for illustration 
purpose only, please do adapt and clean it up :-)
   
   Essentially it is a minor modification to your fix - the issue is that 
`blockManager` referenced in task cleanup in finally is incorrect - as you had 
fixed.
   The only change I introduced is to not need this to be passed in at a Task 
level - but simply grab it at task start time - and also added a test which 
validates this is indeed the issue.
   
   
   This also means that, given the risk with `blockManager` being in 
potentially inconsistent state until initialization is complete - we have to 
add some documentation to it - so that this buggy pattern does not get 
introduced in future again.
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to