jerrypeng commented on code in PR #56387:
URL: https://github.com/apache/spark/pull/56387#discussion_r3464899211


##########
core/src/main/scala/org/apache/spark/shuffle/streaming/ErrorNotifier.scala:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.shuffle.streaming
+
+import java.util.concurrent.atomic.AtomicReference
+
+import org.apache.spark.internal.Logging
+
+/**
+ * Class to notify of any errors that might have occurred out of band.
+ *
+ * Background threads (Netty event loops, task discovery, client creation) 
record errors here
+ * via [[markError]] rather than calling `TaskContext.markTaskFailed` 
directly. The owning task
+ * thread polls [[throwErrorIfExists]] at safe points and re-throws on its own 
thread. This avoids
+ * a race where invoking `markTaskFailed` from a background thread can cause 
the task thread's
+ * subsequent `markTaskCompleted` to silently skip completion listeners 
(including cleanup),
+ * leading to thread leaks.
+ */
+private[spark] class ErrorNotifier extends Logging {

Review Comment:
   The original reason to have two implementation was because they serve two 
completely separate domains and the implementation may evolve overtime to serve 
different functionality.  However, the two is the same today so it make sense 
to consolidate and I will do that.



-- 
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