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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/runtime/ErrorNotifier.scala:
##########
@@ -28,10 +28,14 @@ class ErrorNotifier extends Logging {
 
   private val error = new AtomicReference[Throwable]
 
-  /** To indicate any errors that have occurred */
+  /**
+   * Record a fatal error. Only the first error is retained — subsequent calls
+   * are no-ops so cascading failures cannot mask the original cause.
+   */
   def markError(th: Throwable): Unit = {
-    logError("A fatal error has occurred.", th)
-    error.set(th)
+    if (error.compareAndSet(null, th)) {

Review Comment:
   We mind as well do this then:
   
   ```
   def markError(th: Throwable): Unit = {
     if (!error.compareAndSet(null, th)) {
       // Attach subsequent errors as suppressed so they're not silently lost.
       val existing = error.get()
       if (existing != null && existing != th) {
         existing.addSuppressed(th)
       }
     }
   }
   ```



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