You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "wankunde (via GitHub)" <gi...@apache.org> on 2025/03/14 08:15:47 UTC
[PR] [SPARK-51512][CORE][MINOR] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
wankunde opened a new pull request, #50277:
URL: https://github.com/apache/spark/pull/50277
### What changes were proposed in this pull request?
When the application crashes unexpectedly, the registered map statuses may contain null values, therefore we should skip these null values when cleaning up shuffle data with ExternalShuffleService.
### Why are the changes needed?
Small bug fix
```log
25/03/14 15:41:35 ERROR ContextCleaner: Error cleaning shuffle 4
org.apache.spark.SparkException: Exception thrown in awaitResult:
at org.apache.spark.util.SparkThreadUtils$.awaitResult(SparkThreadUtils.scala:53)
at org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:342)
at org.apache.spark.rpc.RpcTimeout.awaitResult(RpcTimeout.scala:75)
at org.apache.spark.rpc.RpcEndpointRef.askSync(RpcEndpointRef.scala:101)
at org.apache.spark.rpc.RpcEndpointRef.askSync(RpcEndpointRef.scala:85)
at org.apache.spark.storage.BlockManagerMaster.removeShuffle(BlockManagerMaster.scala:204)
at org.apache.spark.shuffle.sort.io.LocalDiskShuffleDriverComponents.removeShuffle(LocalDiskShuffleDriverComponents.java:47)
at org.apache.spark.ContextCleaner.doCleanupShuffle(ContextCleaner.scala:241)
at org.apache.spark.ContextCleaner.$anonfun$keepCleaning$3(ContextCleaner.scala:203)
at org.apache.spark.ContextCleaner.$anonfun$keepCleaning$3$adapted(ContextCleaner.scala:196)
at scala.Option.foreach(Option.scala:437)
at org.apache.spark.ContextCleaner.$anonfun$keepCleaning$1(ContextCleaner.scala:196)
at org.apache.spark.util.Utils$.tryOrStopSparkContext(Utils.scala:1383)
at org.apache.spark.ContextCleaner.org$apache$spark$ContextCleaner$$keepCleaning(ContextCleaner.scala:190)
at org.apache.spark.ContextCleaner$$anon$1.run(ContextCleaner.scala:80)
Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.spark.scheduler.MapStatus.location()" because "mapStatus" is null
at org.apache.spark.storage.BlockManagerMasterEndpoint.$anonfun$removeShuffle$3(BlockManagerMasterEndpoint.scala:423)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at org.apache.spark.storage.BlockManagerMasterEndpoint.$anonfun$removeShuffle$2(BlockManagerMasterEndpoint.scala:421)
at org.apache.spark.storage.BlockManagerMasterEndpoint.$anonfun$removeShuffle$2$adapted(BlockManagerMasterEndpoint.scala:420)
at org.apache.spark.ShuffleStatus.$anonfun$withMapStatuses$1(MapOutputTracker.scala:435)
at org.apache.spark.ShuffleStatus.withReadLock(MapOutputTracker.scala:72)
at org.apache.spark.ShuffleStatus.withMapStatuses(MapOutputTracker.scala:435)
at org.apache.spark.storage.BlockManagerMasterEndpoint.$anonfun$removeShuffle$1(BlockManagerMasterEndpoint.scala:420)
at org.apache.spark.storage.BlockManagerMasterEndpoint.$anonfun$removeShuffle$1$adapted(BlockManagerMasterEndpoint.scala:419)
at scala.Option.foreach(Option.scala:437)
at org.apache.spark.storage.BlockManagerMasterEndpoint.org$apache$spark$storage$BlockManagerMasterEndpoint$$removeShuffle(BlockManagerMasterEndpoint.scala:419)
at org.apache.spark.storage.BlockManagerMasterEndpoint$$anonfun$receiveAndReply$1.applyOrElse(BlockManagerMasterEndpoint.scala:201)
at org.apache.spark.rpc.netty.Inbox.$anonfun$process$1(Inbox.scala:104)
at org.apache.spark.rpc.netty.Inbox.safelyCall(Inbox.scala:216)
at org.apache.spark.rpc.netty.Inbox.process(Inbox.scala:101)
at org.apache.spark.rpc.netty.MessageLoop.org$apache$spark$rpc$netty$MessageLoop$$receiveLoop(MessageLoop.scala:76)
at org.apache.spark.rpc.netty.MessageLoop$$anon$1.run(MessageLoop.scala:42)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
```
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Local test
### Was this patch authored or co-authored using generative AI tooling?
No
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #50277:
URL: https://github.com/apache/spark/pull/50277#discussion_r1997796214
##########
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala:
##########
@@ -418,7 +418,7 @@ class BlockManagerMasterEndpoint(
if (externalShuffleServiceRemoveShuffleEnabled) {
mapOutputTracker.shuffleStatuses.get(shuffleId).foreach { shuffleStatus =>
shuffleStatus.withMapStatuses { mapStatuses =>
- mapStatuses.foreach { mapStatus =>
+ mapStatuses.filter(_ != null).foreach { mapStatus =>
Review Comment:
It means that there's explicit `Some(null)` which we should avoid.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE][MINOR] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2724219738
Could we investigate the reason lead to the null value?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #50277:
URL: https://github.com/apache/spark/pull/50277#discussion_r2026845676
##########
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala:
##########
@@ -418,7 +418,7 @@ class BlockManagerMasterEndpoint(
if (externalShuffleServiceRemoveShuffleEnabled) {
mapOutputTracker.shuffleStatuses.get(shuffleId).foreach { shuffleStatus =>
shuffleStatus.withMapStatuses { mapStatuses =>
- mapStatuses.foreach { mapStatus =>
+ mapStatuses.filter(_ != null).foreach { mapStatus =>
Review Comment:
@HyukjinKwon it's not an `Option` but an `Array`
```
val mapStatuses = new Array[MapStatus](numPartitions)
```
I think the fix is right.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #50277:
URL: https://github.com/apache/spark/pull/50277#discussion_r2026845676
##########
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala:
##########
@@ -418,7 +418,7 @@ class BlockManagerMasterEndpoint(
if (externalShuffleServiceRemoveShuffleEnabled) {
mapOutputTracker.shuffleStatuses.get(shuffleId).foreach { shuffleStatus =>
shuffleStatus.withMapStatuses { mapStatuses =>
- mapStatuses.foreach { mapStatus =>
+ mapStatuses.filter(_ != null).foreach { mapStatus =>
Review Comment:
@HyukjinKwon it's not an `Option` but an `Array`, and the status is not assigned before the map task is accomplished
```
val mapStatuses = new Array[MapStatus](numPartitions)
```
I think the fix is right.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "attilapiros (via GitHub)" <gi...@apache.org>.
attilapiros commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2783496530
LGTM
The change makes sense for me. Even a helper class used by the `MapOutputTrackerMaster` mentions the possible null values (_"Each value in the array is the MapStatus for a partition, or null if the partition is not available."_):
https://github.com/apache/spark/blob/738a50364f16c579e370736df92bf01fe0a06af1/core/src/main/scala/org/apache/spark/MapOutputTracker.scala#L86-L95
Shuffle dependencies are registered very early to the `ContextCleaner` so at a failure/manual stop some map statues can be easily missing.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2724700728
I think we can advance the check at report map status.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE][MINOR] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #50277:
URL: https://github.com/apache/spark/pull/50277#discussion_r1995277288
##########
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala:
##########
@@ -418,7 +418,7 @@ class BlockManagerMasterEndpoint(
if (externalShuffleServiceRemoveShuffleEnabled) {
mapOutputTracker.shuffleStatuses.get(shuffleId).foreach { shuffleStatus =>
shuffleStatus.withMapStatuses { mapStatuses =>
- mapStatuses.foreach { mapStatus =>
+ mapStatuses.filter(_ != null).foreach { mapStatus =>
Review Comment:
It looks weird!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "wankunde (via GitHub)" <gi...@apache.org>.
wankunde commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2724377835
> Could we investigate the reason lead to the null value?
I manually cancelled the running query, the registered running shuffle had no mapStatus for the running tasks.
The shuffle cleaner throws this exception when it cleans up these empty mapStatus asynchronously.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2782695175
cc @attilapiros, @mridulm and @yaooqinn, could you please take look?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn closed pull request #50277: [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService
URL: https://github.com/apache/spark/pull/50277
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-51512][CORE] Filter out null MapStatus when cleaning up shuffle data with ExternalShuffleService [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #50277:
URL: https://github.com/apache/spark/pull/50277#issuecomment-2788486266
LGTM, merged to master. Thank you @wankunde
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org